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:
import collections
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

q = [0]*n
t = 0

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA":
        t += 1

print(sum(q),t)

Submission status: Wrong Answer

Solution code:
#n=int(input())
n,m=map(int,input().split())
#pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
solved_dic={}
for i in range(n):
    solved_dic[i+1]=False

pena=0
solved=0

for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    if s=="WA":
        if not solved_dic[p]:
            pena+=1        
    else:
        if not solved_dic[p]:
            solved+=1
            solved_dic[p]=True

print("{} {}".format(solved,pena))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
answers = [input().split() for _ in range(m)]

num_wa = 0
num_ac = 0
done = set()

for q_num, result in answers:
    q_num = int(q_num)
    if q_num in done:
        continue

    if result == "AC":
        num_ac += 1
        done.add(q_num)
    elif result == "WA":
        num_wa += 1

print(num_ac, num_wa)

Submission status: Wrong Answer

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

n, m = map(int, input().split())
ps = list(list(input().split()) for _ in range(m))

wa = 0
acl = [0]*n
for [p, s] in ps:
    p = int(p)-1
    if s == 'AC' and acl[p] == 0:
        acl[p] += 1
    elif s == 'WA'and acl[p] == 0:
        wa += 1

print(sum(acl), wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [None]*M
S = [None]*M
for i in range(M):
  p[i], S[i] = input().split()

ac = [0]*N
penalty = [0]*N
for i in range(M):
  if S[i] == 'AC':
    ac[int(p[i])-1] = True
  else:
    if ac[int(p[i])-1] == False:
      penalty[int(p[i])-1] += 1
for j in range(N):
  if ac[j] == 'WA':
    penalty[j] = 0
print(*[sum(ac), sum(penalty)])

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [None]*M
S = [None]*M
for i in range(M):
  p[i], S[i] = input().split()

ac = [False]*N
penalty = 0
for i in range(M):
  if S[i] == 'AC':
    ac[int(p[i])-1] = True

for i in range(M):
  if ac[int(p[i])-1] == False:
    penalty += 1
print(*[sum(ac), penalty])

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [None]*M
S = [None]*M
for i in range(M):
  p[i], S[i] = input().split()

ac = [False]*N
penalty = 0
for i in range(M):
  if S[i] == 'AC':
    ac[int(p[i])-1] = True
  else:
    if ac[int(p[i])-1] == False:
      penalty += 1
print(*[sum(ac), penalty])

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split(" "))
L = [0] * M
for i in range(M):
    L[i] = input().split(" ")
    
memoAC = [0] * N
memoWA = [0] * N
for list in L:
    if list[1] == "AC":
        memoAC[int(list[0])-1] = 1
    else:
        if memoAC[int(list[0])-1] != 1:
            memoWA[int(list[0])-1] += 1

for j in range(N):
    if memoAC[j] != 0:
        memoWA[j] = 0

AC = sum(memoAC)
WA = sum(memoWA)
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split(" "))
L = [0] * M
for i in range(M):
    L[i] = input().split(" ")
    
memoAC = [0] * N
memoWA = [0] * N
for list in L:
    if list[1] == "AC":
        memoAC[int(list[0])-1] = 1
    else:
        if memoAC[int(list[0])-1] != 1:
            memoWA[int(list[0])-1] += 1

AC = sum(memoAC)
WA = sum(memoWA)
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = [list(map(str,input().split())) for _ in range(M)]
AC = 0
penalty = 0
WA = 0
AC_list = []

for p,s in PS:
  if p not in AC_list:
    if s == "AC":
      AC += 1
      AC_list.append(p)
      penalty += WA
      WA = 0
    elif s == "WA":
      WA += 1
    else:
      pass
  else:
    pass
  if len(AC_list) == N:
    break
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = 0
penalty = 0
WA = 0
AC_list = []

for i in range(M):
  p,s = map(str,input().split())
  if p not in AC_list:
    if s == "AC":
      AC += 1
      AC_list.append(p)
      penalty += WA
      WA = 0
    elif s == "WA":
      WA += 1
    else:
      pass
  else:
    pass
  if AC == N:
    break
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = 0
penalty = 0
AC_list = []

for i in range(M):
  p,s = map(str,input().split())
  p = int(p)
  if s == "AC" and p not in AC_list:
    AC += 1
    AC_list.append(p)
  elif s == "WA" and p not in AC_list:
    penalty += 1
  else:
    pass
  if len(AC_list) == N:
    break
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = 0
penalty = 0
AC_list = []

for i in range(M):
  p,s = map(str,input().split())
  if s == "AC":
    if p not in AC_list:
      AC += 1
      AC_list.append(p)
    else:
      pass
  elif s == "WA":
    if p not in AC_list:
      penalty += 1
    else:
      pass
  if len(AC_list) == N:
    break
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ps = [list(map(str,input().split())) for _ in range(M)]
AC = 0
penalty = 0
AC_list = []

for i in range(M):
  if ps[i][1] == "AC":
    if ps[i][0] not in AC_list:
      AC += 1
      AC_list.append(ps[i][0])
    else:
      pass
  elif ps[i][1] == "WA":
    if ps[i][0] not in AC_list:
      penalty += 1
    else:
      pass
  if AC == N:
    break
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ps = [list(map(str,input().split())) for _ in range(M)]
AC = 0
penalty = 0
AC_list = []
penalty_list = []
for i in range(M):
  if ps[i][1] == "AC":
    if ps[i][0] not in AC_list:
      AC += 1
      AC_list.append(ps[i][0])
    else:
      pass
  elif ps[i][1] == "WA":
    if ps[i][0] not in penalty_list:
      penalty += 1
      penalty_list.append(ps[i][0])
    else:
      pass
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
def get_ints():
    return map(int, input().split())

n, m = get_ints()
penalty = 0
oks = 0
ac = []
for i in range(n):
    ac.append(False)
for i in range(m):
    p, s = input().split()
    p = int(p)
    p -= 1
    if ac[p]:
        continue
    if s == 'AC':
        ac[p] = True
        oks += 1
    else:
        penalty += 1

print(str(oks) + ' ' + str(penalty))

Submission status: Wrong Answer

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

WA_counts = [0] * N
AC_list = [False] * N
for i in sys.stdin:
    p, S = i.split()
    p = int(p) - 1
    if S == 'WA' and not AC_list[p]:
        WA_counts[p] += 1
    elif S == 'AC':
        AC_list[p] = True

print('{} {}'.format(sum(AC_list), sum(WA_counts)))

Submission status: Wrong Answer

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

ac = [0]*N
pena = [0]*N

for _ in range(M):
    p, s = input().split()
    p = int(p)-1

    if ac[p] == 1:
        continue

    if s == "WA":
        pena[p] += 1
    if s == "AC":
        ac[p] = 1

print(sum(ac), sum(pena))

Submission status: Wrong Answer

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

i_ac = 0
i_wa = 0
listA= []

for i in range(M):
	num,ans = map(str,input().split())
	if ans == "AC":
		if num not in listA:
			listA.append(num)
			i_ac = i_ac + 1
	if ans == "WA":
		if num not in listA:
			i_wa = i_wa + 1

print("{} {}".format(i_ac, i_wa))

Submission status: Wrong Answer

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

i_ac = 0
i_wa = 0
listA= []

for i in range(M):
	num,ans = map(str,input().split())
	if ans == "AC":
		if num not in listA:
			listA.append(num)
			i_ac = i_ac + 1
	elif ans == "WA":
		if num not in listA:
			i_wa = i_wa + 1

print("{} {}".format(i_ac, i_wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
#n問の問題に対し、それぞれWA・ACのログをつける
info = [[] for _ in range(n)]
for _ in range(m):
    p, s = input().split()
    info[int(p) - 1].append(s)
AC = 0
WA = 0
for meta in info:
    for s in meta:
        if s == 'AC':
            AC += 1
            break
        else:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
pli = []
sli = []
for i in range(m):
  ptmp,stmp = input().split()
  pli.append(int(ptmp))
  sli.append(stmp)
correct = 0
correctlog = []
penalty = 0
for i in range(m):
  if pli[i] not in correctlog:
    if sli[i] == 'AC':
      correct += 1
      correctlog.append(pli[i])
    else:
      penalty += 1
print(correct)
print(penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
info = [[] for _ in range(n)]
for _ in range(m):
    p, s = input().split()
    info[int(p) - 1].append(s)

AC = 0
WA = 0

for meta in info:
    for s in meta:
        # print(s)
        if s == 'AC':
            AC += 1
            break
        else:
            WA += 1

print(AC, WA) 
# print(info)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
res = [0] * N
ac = 0
wa = 0

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

Submission status: Wrong Answer

Solution code:
mondaisu, teishutsusu = map(int, input().split())
kekka =[input().split() for i in range(teishutsusu)]
l = [0] * mondaisu
p = [0] * mondaisu
for n, a in kekka:
  if a == 'AC':
    l[int(n) - 1] = 1
  else:
    if l[int(n) - 1] == 0:
      p[int(n) - 1] += 1
print(sum(l), sum(p))

Submission status: Wrong Answer

Solution code:
mondaisu, teishutsusu = map(int, input().split())
kekka =[input().split() for i in range(teishutsusu)]
l = [0] * mondaisu
p = [0] * mondaisu
for n, a in kekka:
  if a == 'AC':
    l[int(n) - 1] = 1
  else:
    if l[int(n) - 1] == 0:
      p[int(n) - 1] += 1

print(sum(l), sum(p))

Submission status: Wrong Answer

Solution code:
input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]
#mondaisuu
N = Line[0]
#teisyutu
M = Line[1]

AC_Lists = [""]*N
# print(AC_Lists)

for i in range(M):
    input_line = input()
    Line = input_line.split()
    # print(AC_Lists[int(Line[0])-1])
    AC_Lists[int(Line[0])-1] += Line[1][0]

AC_count = 0
WA_count = 0

for s in AC_Lists:
    # print(s)
    if 'A' in s:
        AC_count += 1
        my_str = s.split("A")
        # print(my_str)
        # print(len(my_str[0]))
        WA_count += len(my_str[0])
    else:
        # print(len(s))
        WA_count += len(s)
# print(AC_Lists)

print(AC_count,WA_count)

Submission status: Wrong Answer

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

for i in range(m):
  p, s = input().split()
  p = int(p)-1
  if s[0] == "A" and ok[p] == 0:
    ac += 1
    ok[p] = 1
  elif s[0] == "W" and ok[p] == 0:
    wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
x,y=list(map(int, input().split()))
z=[0]*x
for i in range(y):
	a,b=list(map(str, input().split()))
	a=int(a)
	if b=='AC' and z[a-1]<10**6:
		z[a-1]=z[a-1]+10**6
	if b=='WA' and z[a-1]<10**6:
		z[a-1]=z[a-1]+1
ansa=str(sum(z)//(10**6))
ansb=str(sum(z)%(10**6))
print(ansa+' '+ansb)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

penalty=[0]*N
correct=[False]*N

for i in range(M):

    p,s = input().split()
    p = int(p)

    if s=="AC":
        correct[p-1]=True

    else:
        if correct[p-1]==False:
            penalty[p-1] += 1

print(sum(i == True for i in correct),sum(penalty))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N,M = map(int, input().split())
X = list(input().split() for i in range(M))
p=0
c=0

for i in range(N):
    L = [x[1] for x in X if x[0] == str(i+1)]
    if "AC" in L:
        c += 1
    for l in L:
        if l == "WA":
            p += 1
        else:
            break

print(c,p)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N,M = map(int, input().split())
X = list(input().split() for i in range(M))
X=[['1', 'AC'], ['2', 'AC']]
p=0
c=0

for i in range(N):
    L = [x[1] for x in X if x[0] == str(i+1)]
    if "AC" in L:
        c += 1
    for l in L:
        if l == "WA":
            p += 1
        else:
            break

print(c,p)

Submission status: Wrong Answer

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

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

    ac_dic = {}
    ac_score, pena_score = 0, 0
    for i in range(M):
        p, s = input().split()

        if not p in ac_dic:
            if s == "WA":
                pena_score += 1
                ac_dic[p] = False
            else:
                ac_score += 1
                ac_dic[p] = True
        else:
            if s=="WA" and not ac_dic[p]:
                pena_score += 1
            elif s=="AC" and not ac_dic[p]:
                ac_score += 1
                ac_dic[p] = True

    print(ac_score, pena_score)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
import sys

i = list(map(int, input().split()))
N = i[0]
M = i[1]
already_ac = []
ac_count = 0
wa_count = 0
for i in range(M):
    line = sys.stdin.readline().split()
    if int(line[0]) not in already_ac:
        if line[1] == 'AC':
            ac_count += 1
            already_ac.append(int(line[0]))
        else:
            wa_count += 1

print(str(ac_count) + " " + str(wa_count))

Submission status: Wrong Answer

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

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

    ac_dic = {}
    ac_score, pena_score = 0, 0
    for i in range(M):
        p, s = input().split()

        if not p in ac_dic:
            if s == "WA":
                pena_score += 1
            else:
                ac_score += 1
                ac_dic[p] = True
        else:
            if s=="WA" and not ac_dic[p]:
                pena_score += 1
            elif s=="AC" and not ac_dic[p]:
                ac_score += 1
                ac_dic[p] = True

    print(ac_score, pena_score)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N,M = map(int, input().split())
X = list(input().split() for i in range(M))

c=0
p=0

for i in range(N):
    L = [x[1] for x in X if x[0] == str(i+1)]
    if "AC" in L:
        c += 1
    for l in L:
        if l == "WA":
            p += 1
        else:
            break

print(c,p)

Submission status: Wrong Answer

Solution code:
import sys

i = list(map(int, input().split()))
N = i[0]
M = i[1]
not_ac = [n for n in range(1, N + 1)]
ac_count = 0
wa_count = 0
for i in range(M):
    line = sys.stdin.readline().split()
    if int(line[0]) in not_ac:
        if line[1] == 'AC':
            ac_count += 1
            not_ac.remove(int(line[0]))
        else:
            wa_count += 1

print(str(ac_count) + " " + str(wa_count))

Submission status: Wrong Answer

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

for p,s in S:
    if cntAC[int(p)-1] == 0:
        if s == "AC":
            cntAC[int(p)-1] = 1
        elif s == "WA":
            cntWA[int(p)-1] += 1

print(sum(cntAC),sum(cntWA))

Submission status: Wrong Answer

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

    N,M=map(int,input().split())
    P, S = [0] * M, [0] * M
    for i in range(M):
        p, s = input().split()
        S[i] = int(p)
        P[i] = str(s)

    ac=[0]*N
    wa=[0]*N
    for i in range(M):
        if P[i]=='AC':
            ac[S[i]-1]=1
        else:
            if ac[S[i]-1]==0:
                wa[S[i]-1]+=1
            else:
                continue


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






resolve()

Submission status: Wrong Answer

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

    N,M=map(int,input().split())
    P, S = [0] * M, [0] * M
    for i in range(M):
        p, s = input().split()
        S[i] = int(p)
        P[i] = str(s)

    ac=[0]*N
    wa=[0]*N
    end=[]
    for i in range(M):
        if S[i] in end:
            continue
        elif P[i]=='AC':
            ac[S[i]-1]+=1
            end.append(S[i])
        else:
            if ac[S[i]-1]==0:
                wa[S[i]-1]+=1


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






resolve()

Submission status: Wrong Answer

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

    N,M=map(int,input().split())
    P, S = [0] * M, [0] * M
    for i in range(M):
        p, s = input().split()
        S[i] = int(p)
        P[i] = str(s)

    ac=0
    wa=0
    end=[]
    for i in range(M):
        if S[i] in end:
            continue
        elif P[i]=='AC':
            ac+=1
            end.append(S[i])
        else:
            wa+=1

    print(ac,wa)






resolve()

Submission status: Wrong Answer

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

    N,M=map(int,input().split())
    P, S = [0] * M, [0] * M
    for i in range(M):
        p, s = input().split()
        S[i] = int(p)
        P[i] = str(s)

    ac=0
    wa=0
    end=[]
    for i in range(M):
        if P[i]=='AC' and S[i] not in end:
            ac+=1
            end.append(S[i])
        else:
            if P[i]=='WA' and S[i] in end:
                continue
            else:
                if P[i]=='AC' and S[i] in end:
                    continue
                else:
                    wa+=1

    print(ac,wa)






resolve()

Submission status: Wrong Answer

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

    N,M=map(int,input().split())
    P, S = [0] * M, [0] * M
    for i in range(M):
        p, s = input().split()
        S[i] = int(p)
        P[i] = str(s)

    ac=0
    wa=0
    temp=[]
    end=[]
    for i in range(M):
        if S[i] not in temp:
            temp.append(S[i])
        if P[i]=='AC' and S[i] not in end:
            ac+=1
            end.append(S[i])
        else:
            if S[i] not in end:
                wa+=1
    print(ac,wa)






resolve()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [list(map(str, input().split())) for _ in range(M)]

ac = [0]*N
wa = 0

for i, s in ps:
    if ac[int(i)-1]==0:
        if s=='AC':ac[int(i)-1]=1
        elif s=='WA':wa += 1
    
print(sum(ac), wa)

Submission status: Wrong Answer

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

AC = {}
WA = 0
for x in range(M):
    p, S = input().split()
    if S == "AC":
        AC[p] = {"AC"}
    else:
        if p not in AC:
            WA += 1
print(len(AC), WA)

Submission status: Wrong Answer

Solution code:

import numpy as np
def main():
    
    n,m = map(int, input().split())
    
    pena_list = np.zeros(n)
    ac_list = np.zeros(n)

    ans = 0
    for i in range(m):
        p,s = map(str, input().split())
        if s == 'WA':
            if ac_list[int(p)-1] == 0:
                ans += 1
        
        if s == 'AC':
            ac_list[int(p)-1] = 1
        
    print(str(int(sum(ac_list))), ans)



    


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

state = {}
wa = 0
ac = 0
for i in range(m):
  no, result = input().split()
  if result == 'AC':
    if not state.get(no):
      ac += 1
    state[no] = True
  elif result == 'WA':
    if not state.get(no):
      wa += 1

print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

Solution code:
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

n,m = map(int, input().split())
# n = int(input())
# a = list(map(int,input().split()))

ans0,ans1 = 0,0
ac = [False] * n

if m>0:
    for i in range(m):
        p,s = input().split()
        p = int(p)-1
        if ac[p] == False and s == 'WA':
            ans1 += 1
        elif ac[p] == False and s == 'AC':
            ans0 += 1
            ac[p] = True


print(ans0,ans1)

Submission status: Wrong Answer

Solution code:
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

n,m = map(int, input().split())
# n = int(input())
# a = list(map(int,input().split()))

ans0,ans1 = 0,0
ac = [False] * n

for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if ac[p] == False and s == 'WA': ans1 += 1
    elif ac[p] == False and s == 'AC':
        ans0 += 1
        ac[p] = True

print(ans0,ans1)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P=0
score = [0]*(N+1)
for i in range(M):
    p, s =input().split()
    if s == "AC":
        score[int(p)] = 1
    else:
        if score[int(p)] == 1:
            continue
        else:
            P += 1
print(sum(score), P)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
arr = [input().split() for i in range(m)]
q = [int(arr[j][0]) for j in range(m)]
# [q, judges]
judges = [str(arr[h][1]) for h in range(m)]
results = [False]*n
wa_cnt = [0]*n
for k in range(m):
    if results[q[k]-1] == False:
        if judges[k] == "AC":
            results[q[k]-1] = True
        else:
            wa_cnt[q[k]-1] += 1
    else:
        continue
print("{} {}".format(results.count(True), sum(wa_cnt)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
arr = [input().split() for i in range(m)]
q = [int(arr[j][0]) for j in range(m)]
judges = [str(arr[h][1]) for h in range(m)]
results = [False]*n
cnt_ac = 0
cnt_wa = 0
total_wa = 0
for k in range(m):
    if results[q[k]-1] == False:
        if judges[k] == "AC":
            results[q[k]-1] = True
            cnt_ac += 1
            cnt_wa += total_wa
            total_wa = 0
        else:
            total_wa += 1
    else:
        continue
print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
arr = [input().split() for i in range(m)]
q = [int(arr[j][0]) for j in range(m)]
judges = [str(arr[j][1]) for j in range(m)]
results = [False]*n
cnt_ac = 0
cnt_wa = 0
total_wa = 0
for k in range(m):
    if results[q[k]-1] == False:
        if judges[k] == "AC":
            results[q[k]-1] = True
            cnt_ac += 1
            cnt_wa += total_wa
            total_wa = 0
        else:
            total_wa += 1
print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

Solution code:


def submit():
    n, m = map(int, input().split())
    wa_count = {i: 0 for i in range(1, n + 1)}
    ac_status = {i: False for i in range(1, n + 1)}
    
    for _ in range(m):
        p, s = input().split()
        p = int(p)

        if ac_status[p]:
            continue
        
        if s == "AC":
            ac_status[p] = True
        else:
            wa_count[p] += 1

    print("{} {}".format(sum(ac_status.values()), sum(wa_count.values())))


if __name__ == "__main__":
    submit()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[list(input().split()) for _ in range (m)]

a=0
p=0
cl=[]

for i in range (m):
  if not l[i][0] in cl:
    if l[i][1]=='AC':
      a+=1
      cl.append(l[i][0])
    else:
      p+=1
      
print(a,p)

Submission status: Wrong Answer

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

ac = [0]*N

wac = 0
acc = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if s == "AC":
    if ac[p-1] != 1:
      ac[p-1] = 1
      acc += 1
  else:
    if ac[p-1] == 0:
      wac += 1
print(str(acc) +" "+ str(wac))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

n, m = [int(x) for x in stdin.readline().rstrip().split()]

d = [0] * n
clear = 0
miss = 0
for i in range(m):
    p, s = stdin.readline().rstrip().split()
    if d[int(p)-1] == 0:
        if s == "AC":
            clear += 1
            d[int(p)-1] += 1
        else:
            miss += 1

print(str(clear) + ' ' + str(miss))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
wa=0
prob=[0]*(N+1)
for _ in range(M):
    p,S=input().split()
    if S=='AC' and prob[int(p)]==0:
        prob[int(p)]=1
    elif S=='AC' and prob[int(p)]>0:
        pass
    elif prob[int(p)]==0:
        wa+=1
print(sum(prob), wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lst=[list(input().split()) for _ in range(m)]
pena_lst=[0]*n
acn_lst=[0]*n

for p,s in lst:
    p=int(p)-1
    if acn_lst[p]==1:
        continue
    if s =="AC":
        acn_lst[p]=1
    else: pena_lst[p]+=1
pena=0
acn=0
for i in range(n):
    acn+=acn_lst[i]
    if acn_lst[i]==1:
        pena+=pena_lst[i]
print(pena,acn)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lst=[list(input().split()) for _ in range(m)]
print(lst)
pena_lst=[0]*n
acn_lst=[0]*n

for p,s in lst:
    p=int(p)-1
    if acn_lst[p]==1:
        continue
    if s =="AC":
        acn_lst[p]=1
    else: pena_lst[p]+=1
pena=0
acn=0
for i in range(n):
    acn+=acn_lst[i]
    if acn_lst[i]==1:
        pena+=pena_lst[i]
print(pena,acn)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,input().split())
PS = (input().split() for _ in range(M))

ac = [False] * N
wa_cnt = [0] * N
penal = 0
for P,S in PS:
    p = int(P)-1
    if ac[p]:
        pass
    elif S == b'WA':
        wa_cnt[p] += 1
    else:
        ac[p] = True
        penal += wa_cnt[p]

ac = sum(ac)
print(ac, penal)

Submission status: Wrong Answer

Solution code:
def solve():
    N, M = map(int, input().split())
    isAC = [False] * N

    n_penalty = 0
    for i in range(M):
        p, S = input().split()
        p = int(p) - 1

        if S == 'WA':
            if not isAC[p]:
                n_penalty += 1
        
        if S == 'AC':
            isAC[p] = True
    
    print(sum(isAC), n_penalty)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
answered = [False] * n
ans = 0
pena = 0
for _ in range(m):
    p, s = input().split()
    pidx = int(p) - 1
    if answered[pidx]:
        continue
    if s == "AC":
        ans += 1
        answered[pidx] = True
    else:
        pena += 1
print("{} {}".format(ans, pena))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
AC=[0]*n
penalty=0
for _ in range(m):
    p,s = map(str, input().split())
    p=int(p)
    if AC[p-1]==0:
        if s=="AC":
            AC[p-1]=1
        else:
            penalty+=1
print(sum(AC),penalty)

Submission status: Wrong Answer

Solution code:
N,M=[int(s) for s in input().split()]
ACls=[0 for _ in range(N)]
ans=[0,0]
for i in range(M):
  a,b=input().split()
  a=int(a)-1
  if b=='AC':
    if ACls[a]==0:
      ACls[a]=1
      ans[0]+=1
  else:
    if ACls[a]==0:
      ans[1]+=1
print(*ans)

Submission status: Wrong Answer

Solution code:
N,M=[int(s) for s in input().split()]
WAls=[0 for _ in range(N)]
ACls=[0 for _ in range(N)]
for i in range(M):
  a,b=input().split()
  a=int(a)-1
  if b=='AC':
    ACls[a]=1
  else:
    if ACls[a]==0:
      WAls[a]+=1
ans=[sum(ACls),sum(WAls)]
print(*ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ll = [list(input().split()) for _ in [0]*m]
s = set()
ans = [0,0]
for l in ll:
  if l[0] not in s:
    if l[1] == 'AC':
      s.add(l[0])
      ans[0] += 1
    else:
      ans[1] += 1
print(' '.join(list(map(str,ans))))

Submission status: Wrong Answer

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

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

ANS = sum(ans)
PEN = sum(pen)

print(ANS, PEN)

Submission status: Wrong Answer

Solution code:
n , m = map(int, input().split())
x = [input().split() for _ in range(m)]

ac, wa = 0, 0
ac_list = []

for p, s in x:
    if p in ac_list:
        continue
    if s == 'AC':
        ac_list.append(p)
        ac += 1
    else:
        wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
d = {}
ac_count = 0
wa_count = 0
for i in range(M):
    q, s = input().split()
    d.setdefault(q, '')
    if d[q] == 'AC':
        continue
    d[q] = s
    if s == 'WA':
        wa_count += 1
    else:
        ac_count += 1
print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
d = {}
ac_count = 0
wa_count = 0
for i in range(M):
    q,s = input().split()
    if not q in d:
        d[q] = ''
    if d[q] == 'AC':
        continue
    d[q] = s
    if s == 'WA':
        wa_count += 1
    else:
        ac_count += 1
print(ac_count,wa_count)