Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

The i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).

The number of Takahashi's correct answers is the number of problems on which he received an AC once or more.

The number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.

Find the numbers of Takahashi's correct answers and penalties.

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

Print the number of Takahashi's correct answers and the number of Takahashi's penalties.

Sample Input 1

2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Sample Output 1

2 2

In his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.

In his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

Note that it is pointless to get an AC more than once on the same problem.

Sample Input 3

6 0

Sample Output 3

0 0



Sample input:
2 5
1 WA
1 AC
2 WA
2 AC
2 WA


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

AC = [False for _ in range(N)]

n_AC = 0
n_WA = 0

for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if not AC[p]:
        if s == "AC":
            AC[p] = True
            n_AC += 1
        elif s == "WA":
            n_WA += 1

print(n_AC, n_WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
P=[]
S=[]
for i in range(m):
    p,s=input().split()
    P.append(int(p))
    S.append(s)
A=[0]*n #1がAC
W=[0]*n #WA数
for i in range(m):
    if A[P[i]-1]==0:
        if S[i]=="WA":
            W[P[i]-1]+=1
        else:
            A[P[i]-1]=1
print(sum(A),sum(W))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,p = map(int,input().split())

ac = np.array([0]*n)
wa = np.array([0]*n)

for i in range(p):
    p,s = input().split()
    if ac[int(p) - 1] == 0 and s == "WA":
        wa[int(p) - 1] += 1
    else:
        ac[int(p) - 1] = 1

if sum(ac) == 0:
    print(0,0)
else:
    print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n, m = map(int, input().split())
ac = 0
wa = 0
quest = 0
result = 'WA'
clear = set()



for i in range(m):
    p, s = map(str, input().split())
    if quest == p and s == 'WA' and p not in clear:
        wa += 1
    elif quest == p and s == 'AC' and p not in clear:
        ac += 1
        clear.add(p)
    elif quest != p and s == 'WA' and p not in clear:
        wa += 1
    elif quest != p and s == 'AC' and p not in clear:
        ac += 1
        clear.add(p)

    quest = p

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [0]*m
s = [0]*m
c = [0]*(m + 1)
c[-1] = -11
j = 1
for i in range(m):
    p[i],s[i] = map(str,input().split())
    if i == 0:
        c[i] = str(p[i])
    elif c[j - 1] != p[i]:
        c[j] = str(p[i])
        j += 1
ac = 0
wa = 0
j = 0
for i in range(m):

    if p[i] == c[j] and s[i] == "AC":
        ac += 1
        j += 1
        for k in range(m - j):
            if c[k + j] == p[j]:
                j +=1
                break
        if c[j] == 0 or c[j] == -11:
            break
    elif s[i] == "WA" :
        wa += 1

print("{} {}".format(ac,wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
corrects = [0] * n
penalties = [0] * n
for i in range(m):
    p, S = input().split()
    p = int(p) - 1
    if corrects[p]:
        continue
    if S == 'AC':
        corrects[p] = 1
    elif S == 'WA':
        penalties[p] += 1

print("{} {}".format(sum(corrects), sum(penalties)))

Submission status: Wrong Answer

Solution code:
N, M = tuple(map(int, input().split()))
P, S = [], []
for _ in range(M):
    p, s = input().split()
    P.append(int(p))
    S.append(s)

accepted = [False for _ in range(N)]
AC = 0
WA = 0
for p, s in zip(P, S):
    if s == "WA":
        if not accepted[p-1]:
            WA += 1
    elif s == "AC":
        accepted[p-1] = True
        AC += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = tuple(map(int, input().split()))
P, S = [], []
for _ in range(M):
    p, s = input().split()
    P.append(int(p))
    S.append(s)

AC = [False] * N
WA = 0
for p, s in zip(P, S):
    if s == "WA":
        if AC[p-1] is False:
            WA += 1
    else:
        AC[p-1] = True
print(sum(AC), WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
corrects = [0] * n
penalties = [0] * n
for i in range(m):
    result = input().split()
    number = int(result[0]) - 1
    if result[1] == 'AC':
        corrects[number] = 1
    else:
        if corrects[number] == 0:
            penalties[number] += 1

print("{} {}".format(sum(corrects), sum(penalties)))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N, M, *pS = open(0).read().split()
p = pS[::2]
S = pS[1::2]
lst = []
for pi, Si in zip(p, S):
  lst.append((pi, Si))
lst.sort(key=itemgetter(0))
AC = [0] * int(N)
WA = [0] * int(N)
pre = ""
cnt = 0
for li in lst:
  if li[0] == pre:
    continue
  if li[1] == "AC":
    AC[int(li[0]) - 1] += 1
    WA[int(li[0]) - 1] += cnt
    cnt = 0
    pre = li[0]
  else:
    cnt += 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p=[0]*m
s=[0]*m
wal=[0]*(10**6)
acl=[0]*(10**6)
for i in range(m):
    p[i],s[i]=map(str, input().split())
wa_cnt=0
pnum=0
for i in range(m):
    if pnum!=int(p[i]):
        wa_cnt=0
        pnum=int(p[i])
    if s[i]=="AC" and acl[int(p[i])]==0:
        acl[int(p[i])]=1
        wal[int(p[i])]=wa_cnt
        wa_cnt=0
    if s[i]=="WA" and acl[int(p[i])]==0:
        wa_cnt+=1
    
print(sum(acl),sum(wal))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p=[0]*m
s=[0]*m
wal=[0]*(10**5+100)
acl=[0]*(10**5+100)
for i in range(m):
    p[i],s[i]=map(str, input().split())
wa_cnt=0
for i in range(m):
    if s[i]=="AC" and acl[int(p[i])]==0:
        acl[int(p[i])]=1
        wal[int(p[i])]=wa_cnt
        wa_cnt=0


    if s[i]=="WA" and acl[int(p[i])]==0:
        wa_cnt+=1
    
print(sum(acl),sum(wal))

Submission status: Wrong Answer

Solution code:
"""
author : dokueki
"""
n,m = map(int,input().split())
d = dict()
AC,WA = 0,0
tot = 0
if m == 0:
    print(0,0)
else:
    for i in range(m):
        a, b = input().split()
        if a not in d:
            d[a] = []
            d[a].append(b)
        else:
            if d[a].count("AC") == 0:
                d[a].append(b)
    for k,v in d.items():
        tot += len(v)

    for k,v in d.items():
        AC += v.count("AC")
    print(AC,tot-AC)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

def pin(type=int):
    return eval("map(type,input().split())")
#1行ごとに読み込んでいる
#変数一個だけのときはカンマを入れるだけ、input()相当。ちょろい。
#下記のようにsum関数などintを相手にした関数を書く時に便利なのでデフォルトをint型にする
N,M = pin()
p=[0 for i in range(0,M)]
S=[0 for i in range(0,M)]
for i in range(0,M):
    p[i],S[i] =pin(str)

#print(p,S)
#ACした問題番号と各々の問題（後々AC下かを考えない）ペナ数を問題番号別にまとめた配列
AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]
#問題番号iと回答番号jについて,
for i in range(0,N):
    for j in range(0,M):
    
        #jがiの回答である時に,WAだったらPenaltiesに1個加算
        if int(p[j])-1==i:
            if (S[j]) == 'WA':
                Penalties[int(p[j])-1] += 1
            else:#それが初めてのACならば、AC数に1を足してcontinueで次の問題i+1へ移る
                AC[int(p[j])-1] = 1
                break
            print(AC,Penalties)
print(AC,Penalties)
acnum=0
pennum=0
for i in range(0,N):
    acnum += AC[i]
    if AC[i]==1:
        pennum += Penalties[i]

print(acnum,pennum)

Submission status: Wrong Answer

Solution code:
"""
author : dokueki
"""
n,m = map(int,input().split())
d = dict()
AC,WA = 0,0
if m == 0:
    print(0,0)
else:
    for i in range(m):
        a, b = input().split()
        if a not in d:
            d[a] = []
            d[a].append(b)
        else:
            if d[a].count("AC") == 0:
                d[a].append(b)

    for k,v in d.items():
        WA += v.count("WA")
        AC += v.count("AC")
    print(AC,WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
lst = [False] * n
ac = 0
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  s = True if s == 'AC' else False
  if not lst[p - 1]:
    if s:
      ac += 1
      lst[p - 1] = True
    else:
      wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N, M, *pS = open(0).read().split()
p = pS[::2]
S = pS[1::2]
lst = []
for pi, Si in zip(p, S):
  lst.append((pi, Si))
lst.sort(key=itemgetter(0))
AC = [0] * int(N)
WA = [0] * int(N)
pre = ""
for li in lst:
  if li[0] == pre:
    continue
  if li[1] == "AC":
    AC[int(li[0]) - 1] += 1
    pre = li[0]
  else:
    WA[int(li[0]) - 1] += 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

def pin(type=int):
    return eval("map(type,input().split())")
#1行ごとに読み込んでいる
#変数一個だけのときはカンマを入れるだけ、input()相当。ちょろい。
#下記のようにsum関数などintを相手にした関数を書く時に便利なのでデフォルトをint型にする
N,M = pin()
p=[0 for i in range(0,M)]
S=[0 for i in range(0,M)]
for i in range(0,M):
    p[i],S[i] =pin(str)

#print(p,S)
#ACした問題番号と各々の問題（後々AC下かを考えない）ペナ数を問題番号別にまとめた配列
AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]
#問題番号iと回答番号jについて,

for j in range(0,M):
    #jがiの回答である時に,WAだったらPenaltiesに1個加算
    if (S[j]) == 'WA':
        Penalties[int(p[j])-1] += 1
    else:#それが初めてのACならば、AC数に1を足してcontinueで次の問題i+1へ移る
        AC[int(p[j])-1] = 1
        continue

acnum=0
pennum=0
for i in range(0,N):
    acnum += AC[i]
    if AC[i]==1:
        pennum += Penalties[i]

print(acnum,pennum)

Submission status: Wrong Answer

Solution code:
N, M, *pS = open(0).read().split()
p = pS[::2]
S = pS[1::2]
AC = [0] * int(N)
WA = [0] * int(N)
pre = -1
for pi, Si in zip(p, S):
  if pi == pre:
    continue
  if Si == "AC":
    AC[int(pi) - 1] += 1
    pre = pi
  else:
    WA[int(pi) - 1] += 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
result = []

problems = [False for _ in range(n)]
wa_count = 0

for i in range(m):
    s = list(input().split(' '))
    if s[1] == 'AC':
        problems[int(s[0])-1] = True
    else:
        result.append(s)
    if int(s[0]) == n and s[1] == 'AC':
        problems[int(s[0]) - 1] = True
        break

for i, j in result:
    if problems[int(i)-1] == True:
        wa_count += 1

ac_count = problems.count(True)
print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
#-------------------------------------------------------------------
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
N,M = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

AC=[0]*(N+1)
WA=[0]*(N+1)

for i in range(M):
	q,s = input().split()
	p=int(q)
	
	if s=="AC":
		AC[p]=1
	
	if s=="WA":
		if AC[p]==0: WA[p]+=1


print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
p = []
S = []
AC_cnt = 0
WA_cnt = 0
for i in range(M):
    tmp_p, tmp_S = input().split()
    tmp_p = int(tmp_p)
    p.append(tmp_p)
    S.append(tmp_S)
p_cnt = [0 for i in range(N)]
for i in range(M):
    if p_cnt[p[i]-1]==1:
        continue
    if S[i]=="AC":
        AC_cnt+=1
        p_cnt[p[i]-1]=1
    elif S[i]=="WA":
        WA_cnt+=1
print(AC_cnt,WA_cnt)

Submission status: Wrong Answer

Solution code:
n,m=(int(x) for x in input().split())
aclist=["none"]*(n+1)
ac=0
wa=0
for i in range(m):
  p,s=input().split()
  p=int(p)
  if((aclist[p]!='AC')and(s=="AC")):
    ac=ac+1
  if((aclist[p]!='AC')and(s=="WA")):
    wa=wa+1
  if(aclist[p]!="AC"):
    aclist[p]=s
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
p = []
S = []
now_p = -1
AC_cnt = 0
WA_cnt = 0
cnt_flag = 0
for i in range(M):
    tmp_p, tmp_S = input().split()
    tmp_p = int(tmp_p)
    p.append(tmp_p)
    S.append(tmp_S)
for i in range(M):
    if p[i]!=now_p:
        cnt_flag = 0
    if S[i]=="WA" and cnt_flag == 0:
        WA_cnt+=1
    elif S[i]=="AC" and cnt_flag == 0:
        AC_cnt+=1
        cnt_flag = 1
    now_p = p[i]

print(AC_cnt,WA_cnt)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split(" ")))
answer_list = []

current_question = 0
current_status = ""
current_penalty = 0
right = 0
penalty = 0

for _ in range(m):
  p, s = input().split(" ")
    
  if current_question != p:
    current_question = p
    current_status = ""
    current_penalty = 0
  
  if current_status == "AC":
    continue
    
  if s == "AC":
    right += 1
    current_status = "AC"
    penalty += current_penalty
  else:
    current_penalty += 1
    
print(str(right) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split(" ")))
answer_list = []

current_question = 0
current_status = ""
current_penalty = 0
right = 0
penalty = 0

for _ in range(m):
  p, s = input().split(" ")
    
  if current_question != p:
    current_question = p
    current_status = ""
    current_penalty = 0
  
  if current_status == "AC":
    continue
    
  if s == "AC":
    right += 1
    current_status = s
    penalty += current_penalty
  else:
    current_penalty += 1
    
print(str(right) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
def main():
    """
    acのあとにwaもあるということ。
    初めてacになるまでのwaが問題。一度acになったらもうその問題はおしまい。
    正答数: ACを出した問題の数
    ペナルティ数: 最初のACに至るまでのWA数
    """

    n, m = map(int, input().split(' '))

    submits = []
    for _ in range(m):
        p, s = input().split(' ')
        submits.append((int(p), s))

    submits_iter = iter(submits)
    submit = next(submits_iter, None)
    done = set()
    passed = 0
    penalties = 0
    while submit:
        p, s = submit
        if p not in done:
            if s == 'AC':
                passed += 1
                done.add(p)
            else:
                penalties += 1
        submit = next(submits_iter, None)
    print('%s %s' % (passed, penalties))


main()

Submission status: Wrong Answer

Solution code:
n,m = map(int, list(input().split()))
pts = {}
wa = 0
ac = 0
for _ in range(m):
    p,s = list(input().split());
    if s == 'AC':
        if p not in pts or pts[p] != -1:
            pts[p] = -1
            ac+=1
    else:
        if p in pts and pts[p]!= -1:
            pts[p] += 1
            wa+=1
        elif p not in pts:
            pts[p] = 1
            wa+=1
            
print(ac,wa,sep=' ')

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
co = [0]*N
pe = [0]*N
for i in range(M) :
  p,s = input().split()
  p = int(p)-1
  if co[p]==1 :
    continue
  elif co[p]==0 and s=="WA" :
    pe[p] += 1
  elif co[p]==0 and s=="AC" :
    co[p] = 1
    
print(sum(co),sum(pe))

Submission status: Wrong Answer

Solution code:
wa = 0
l = []

n,m = map(int,input().split())
for i in range(m):
    a = list(map(str,input().split()))
    if a[1] == 'AC':
        l.append(a[0])
    else:
        if not a[0] in l:
            wa += 1

ac = len(set(l))

print(ac,wa)

Submission status: Wrong Answer

Solution code:
def main():
    """
    acのあとにwaもあるということ。
    初めてacになるまでのwaが問題。一度acになったらもうその問題はおしまい。
    正答数: ACを出した問題の数
    ペナルティ数: 最初のACに至るまでのWA数
    """

    n, m = map(int, input().split(' '))

    submits = []
    for _ in range(m):
        p, s = input().split(' ')
        submits.append((int(p), s))

    submits_iter = iter(submits)
    submit = next(submits_iter, None)
    done = set()
    passed = 0
    penalties = 0
    while submit:
        p, s = submit
        if p in done:
            submit = next(submits_iter, None)
        elif s == 'AC':
            passed += 1
            done.add(p)
        else:
            penalties += 1
        submit = next(submits_iter, None)
    print('%s %s' % (passed, penalties))


main()

Submission status: Wrong Answer

Solution code:
"""
author : dokueki
"""
n,m = map(int,input().split())
d = dict()
res = []
if m == 0:
    print(0,0)
else:
    for i in range(m):
        a, b = input().split()
        if a not in d:
            d[a] = []
            d[a].append(b)
        else:
            if d[a].count("AC") == 1:
                pass
            else:
                d[a].append(b)
    for k,v in d.items():
        res.extend(v)
    print(res.count("AC"),res.count("WA"))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [input().split() for i in range(M)]
s1=list()
s2=list()
p=0
w=0
for i in range(M):
    if A[i][0] not in s2 and A[i][1]=="WA":
        s1 +=A[i][0]
    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1 
        s2 +=A[i][0]
        w += int(s1.count(A[i][0]))
print(p,w)

Submission status: Wrong Answer

Solution code:
wa = 0
l = []

n,m = map(int,input().split())
for i in range(m):
    a = list(map(str,input().split()))
    if a[1] == 'WA':
        wa += 1
    else:
        l.append(int(a[0]))

ac = len(set(l))

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int ,input().split())
s = [0] * n
cnt = [0] * n
for i in range(m):
    P, S = input().split()
    p = int(P)
    p -= 1
    if(S == "AC" and s[p] == 0):
        s[p] = 1
    elif(S == "WA" and s[p] == 0):
        cnt[p] += 1
print(sum(s), sum(cnt))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(n)]

n_correct = 0
n_penalty = 0

for i in range(m):
    if isACed[p[i]-1] != 1:
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split(" ")))
answer_list = []

current_question = 0
current_status = ""
right = 0
penalty = 0

for _ in range(m):
  p, s = input().split(" ")
    
  if current_question != p:
    current_question = p
    current_status = ""
  
  if current_status == "AC":
    continue
    
  if s == "AC":
    right += 1
    current_status = s
  else:
    penalty += 1
    
print(str(right) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
C=[[0,0] for i in range(N)]

for i in range(M):
  p,S=input().split()
  x=int(p)-1
  if C[x][0]==0:
    if S=="WA":
      C[x][1]+=1
    else:
      C[x][0]=1

print(sum([C[i][0] for i in range(N)]),sum([C[i][1] for i in range(N)]))

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
penalty=0
correct=0
count=0
num=[]
judge=[]
quiznum=[]
for i in range(M):
  inp=list(input().split())
  num.append(int(inp[0]))
  judge.append(str(inp[1]))
for i in range(M):
  if judge[i]=='WA' and not(num[i] in quiznum):
    count+=1
  if judge[i]=='AC' and not(num[i] in quiznum):
    quiznum.append(num[i])
    correct+=1
    penalty += count
    count = 0
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
tmp = []

tmp = list(map(int, input().split()))

m = tmp.pop()
n = tmp.pop()

tmp.clear

flag = []
flag = [False]*n

correct = 0
penalty = 0

for i in range(m):
    tmp = input().split()
    status = tmp.pop()
    num = int(tmp.pop())
    if flag[num-1] == False:
        if status == "WA":
            penalty = penalty + 1
        elif status == "AC":
            correct = correct + 1
            flag[num-1] = True


print("{} {}".format(correct, penalty))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
wrong_list = [0] * (n + 1)
correct_list = [0] * (n + 1)
correct_answers = 0
wrong_answers = 0

for i in range(m):
    p, s = input().split()
    if correct_list[int(p)] == 0 and s == "WA":
        wrong_list[int(p)] += 1
    if s == "AC":
        correct_list[int(p)] = 1

print(str(sum(correct_list[1:])) + " " + str(sum(wrong_list[1:])))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
wrong_list = [0] * (n + 1)
correct_list = [0] * (n + 1)
correct_answers = 0
wrong_answers = 0

for i in range(m):
    p, s = input().split()
    if correct_list[int(p)] == 0 and s == "WA":
        wrong_list[int(p)] += 1
    if s == "AC":
        correct_list[int(p)] = 1

print(str(sum(correct_list)) + " " + str(sum(wrong_list)))

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())

ac_=[0]*n
ac=0
wa=0

for i in range(m):
	q,r=input().split()
	q=int(q)-1
	if ac_[q]==0:
		if r=='WA':
			wa+=1
		if r=='AC':
			ac+=1
			ac_[q]=1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ok = [False] * N
ac = 0
wa = 0
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if ok[p]:
        continue
    else:
        if s == "AC":
            ac += 1
            ok[p] = True
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N,M = list(map(int, input().split()))

AC = [False for _ in range(N)]
WA = [0 for _ in range(N)]
total_WA = 0

for _ in range(M):
    p,s = input().split()
    p = int(p)-1
    if AC[p]:
        continue
    if s=='AC':
        AC[p] = True
        total_WA += WA[p]
    else:
        WA[p] += 1

print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N,M = list(map(int, input().split()))

AC = [False for _ in range(N)]
WA = [0 for _ in range(N)]

for _ in range(M):
    p,s = input().split()
    p = int(p)-1
    if AC[p]:
        continue
    if s=='AC':
        AC[p] = True
    else:
        WA[p] += 1

print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
ac_flg={(i+1):0 for i in range(N)}
ac_num = 0
wa_num = 0
for i in range(M):
  n, res = input().split()
  n = int(n)
  if ac_flg[n]==0:
    if res=="AC":
      ac_flg[n]=1
      ac_num = ac_num + 1
    if res=="WA":
      wa_num = wa_num+1
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N, M = map(int, input().split())

a_dict = {}

for _ in range(0, M):
    p, s = map(str, input().split())
    if p in a_dict:
        a_dict[p].append(s)
    else:
        a_dict[p] = [s]

ans = 0
pena = 0

for k, v in a_dict.items():
    if 'AC' in v:
        ans += 1

    for b in v:
        if b == 'AC':
            break
        else:
            pena += 1

print('{} {}'.format(ans, pena))

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=[False for _ in range(n)]

  ans1=ans2=0
  for _ in range(k):
    a,b=LS()
    a=int(a)

    if b=='WA':
      if l[a-1]==False:
        ans2+=1
    else:
      if l[a-1]==False:
        l[a-1]=True
        ans1+=1

  return str(ans1)+' '+str(ans2)

# main()
print(main())

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = [0 for _ in range(n)]
ac = [0 for _ in range(n)]
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        ac[p-1] = 1
    else:
        if ac[p-1]==1:continue
        wa[p-1] += 1

print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = [0 for _ in range(n)]
ac = [0 for _ in range(n)]
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        ac[p-1] = 1
    else:
        if ac[p-1]:continue
        wa[p-1] += 1

print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, m = map(int, input().split())

penalties = defaultdict(int)
solved = set()

for _ in range(m):
    p,S = input().split()

    if p in solved:
        continue
    if S=='WA':
        penalties[p]+=1
    else:
        solved.add(p)

print(len(solved),sum(penalties.values()))

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())

l = [list(input().split()) for i in range(m)]
ans1 = int(0)
ans2 = int(0)
ans3 = int(0)
No = []

for i in range(m):
  for j in range(1,n+1):
    if ans2 >= n:
      break
    if j == int(l[i][0]) and "WA" == l[i][1]:
      ans1 += 1
    if j == int(l[i][0]) and "AC" == l[i][1]:
      ans3 = l.count(l[i])
      if ans3 == 1:
        ans2 += 1
        ans3 = 0
      else:
        l.remove(l[i])
        l.append([0,"0"])
        ans3 = 0

print(ans2, ans1)

Submission status: Wrong Answer

Solution code:
#import sys
#input = sys.stdin.buffer.readline
import collections

def main():
    N,M = map(int,input().split())
    ans = [False for _ in range(N)]
    count = 0
    for i in range(M):
        pro,judge = map(str,input().split())
        pro = int(pro)-1
        if ans[pro] == True:
            continue
        else:
            if judge == "AC":
                ans[pro] = True
            else:
                count += 1
                
    ans = collections.Counter(ans)
                
    print(ans[True],count)
        
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = [0] * n
pen = [0] * n
pen_count = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if ac[p] == "AC":
        continue
    elif s == "AC":
        ac[p] = "AC"
    else:
        pen[p] += 1

for i in range(n):
    if ac[i] == "AC":
        pen_count = pen[i]

print(ac.count("AC"), pen_count)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m = inpl()
sc = [input().split() for i in range(m)]
ac = 0
pena = 0
stpe = 0
prob = [False] * (n+1)
for s,c in sc:
    s = int(s)
    if prob[s]:
        continue
    else:
        if c == 'AC':
            prob[s] = True
            ac += 1
            pena += stpe
            stpe = 0
        else:
            stpe += 1
print(ac,pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
WAC = [0 for i in range(N)]
TF = [0 for i in range(N)]
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if S == 'AC':
        TF[p] = 1

    if TF[p] == 0 and S == 'WA':
        WAC[p] += 1

print(sum(TF), sum(WAC))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS=[]
for i in range(M):
    PS.append(input().split())
    PS[i][0]=int(PS[i][0])

ac=[False for i in range(N)]

AC=0
WA=0

for i in range(M):
    if ac[PS[i][0]-1]:
        continue
    else:
        if PS[i][1]=="AC":
            ac[PS[i][0]-1]=True
            AC+=1
        else:
            WA+=1
            
print("{} {}".format(AC,WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

cnt=[0]*N
ans=[0]*N

for i in range(M):
    p, s = input().split()
    p=int(p)-1
    
    if ans[p] == 1:
        continue
    elif s == 'AC':
        ans[p]=1
    else:
        cnt[p]+=1
    
print(sum(ans), sum(cnt))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = [0] * n
pen = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if ac[p] == "AC":
        continue
    elif s == "AC":
        ac[p] = "AC"
    else:
        pen += 1

print(ac.count("AC"), pen)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m = inpl()
sc = [input().split() for i in range(m)]
ac = 0
pena = 0
prob = [False] * (n+1)
for s,c in sc:
    s = int(s)
    if prob[s]:
        continue
    else:
        if c == 'AC':
            prob[s] = True
            ac += 1
        else:
            pena += 1
print(ac,pena)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, M = map(int, input().split())

results = defaultdict(list)
for _ in range(M):
    p, s = input().split()
    results[p].append(s)

acCnt = 0
waCnt = 0
for result in results.values():
    for s in result:
        if s == 'AC':
            acCnt += 1
            break
        waCnt += 1

print(acCnt, waCnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac = [0]*n
wa = [0]*n

num_ac = 0
num_wa = 0
solved = []

for i in range(m):
  p,s = input().split()
  p = int(p)-1
  if s == 'AC':
     ac[p] = 1
  elif s == 'WA':
    if ac[p] == 1:
      continue
    else:
      wa[p] += 1
    
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
c = 0
ac = 0
wa = 0
f = 1
for i in range(M):
    p,s = input().split()
    p = int(p)
    if p != c:
        c = p
        f = 0
    if s == 'WA' and f == 0:
        wa += 1
    elif s == 'AC' and f == 0:
        f = 1
        ac += 1
print("{} {}".format(ac,wa))

Submission status: Wrong Answer

Solution code:

N,M = map(int,input().split())

#print(N,M)

num=[]
answer=[]
correct=[]
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
#print(num)
#print(answer)
    

preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        if preCorrect == True:
            preCorrect = False
            temp_wrongCount = 0
        else:
            temp_wrongCount = 0
    
    
    if preCorrect == True:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1

print(correctCount, wrongCount)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
num_ac = 0
num_wa = 0
tmp_num_wa = 0
solved = []

for i in range(m):
  p,s = input().split()
  if p in solved:
    continue
  elif s == 'WA':
    tmp_num_wa += 1
  elif s == 'AC':
    num_ac += 1
    num_wa += tmp_num_wa
    tmp_num_wa = 0
    solved.append(p)
    
print(num_ac, num_wa)