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())
submits =  [list(input().split()) for i in range(M)]

penalties = [0 for _ in range(N)]
acs = [False for _ in range(N)]

for i, submit in enumerate(submits):
    p = int(submit[0])-1
    if acs[p]:
        continue
    if submit[1] == 'AC':
        acs[p] = True
    else:
        penalties[p] += 1

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

Submission status: Wrong Answer

Solution code:

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

x = [0]*(n+1) #correct = 1
y = [0]*(n+1) #penalty

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if x[p-1] == 0:
        if s == "WA":
            y[p-1] += 1
        else:
            x[p-1] = 1
    elif x[p-1] == 1:
        if s == "AC":
            pass
        elif s == "WA":
            pass

ans1 = sum(x)
ans2 = sum(y)

print(ans1,ans2)

Submission status: Wrong Answer

Solution code:

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

x = [0]*n #correct = 1
y = [0]*n #penalty

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if x[p-1] == 0:
        if s == "WA":
            y[p-1] += 1
        else:
            x[p-1] = 1
    elif x[p-1] == 1:
        if s == "AC":
            pass
        elif s == "WA":
            pass

ans1 = sum(x)
ans2 = sum(y)

print(ans1,ans2)

Submission status: Wrong Answer

Solution code:

n,m = map(int,input().split())
ans = [0]*n
miss = [0]*n

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
#    print(p,s)
    if ans[p-1] == 1:
        pass
    elif ans[p-1] == 0 and s == "WA":
        miss[p-1] += 1
    elif ans[p-1] == 0 and s == "AC":
        ans[p-1] += 1
    else:
        pass

#print(ans)
#print(miss)
a = sum(ans)
b = sum(miss)

print(a,b)

Submission status: Wrong Answer

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

penalty = 0
a = [[False, 0] for i in range(N)]
count = 0

for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    if a[p][0] == False:
        if S == 'WA':
            a[p][1] += 1
        else:
            a[p][0] = True
            count += 1
    else:
        pass

print(count, sum([a[i][1] for i in range(N)]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
AC=0
WA=0
AC_list=[0]*(n+1)
x=0

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

Submission status: Wrong Answer

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

ac = [0] * n
wa = [0] * n
for i in range(m):
    p, s = p_li[i] - 1, s_li[i]
    if s == 'AC':
        ac[p] += 1
    elif ac[p] == 0:
        wa[p] += 1
    else:
        continue
ans = (n - ac.count(0), sum(wa))
print('{} {}'.format(ans[0], ans[1]))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = [input().split() for m in range(M)]
S = []
a = 0

for p,s in P:
  if p not in S:
    if s=="AC":
      S.append(p)
    else:
      a+=1

print(len(S),a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
a=[0]*N#正解した問題一覧
b=0
for i in range(M):
    s=list(map(str,input().split()))
    if s[1]=="AC" and a[int(s[0])-1]==0:
        a[int(s[0])-1]+=1
    elif s[1]=="AC" and a[int(s[0])-1]==1:
        pass
    elif s[1]=="WA" and a[int(s[0])-1]==0:
        b+=1
    
    
print(sum(a),b)

Submission status: Wrong Answer

Solution code:

N,M=map(int,input().split())
a=[0]*N#正解した問題一覧
b=0
for i in range(M):
    s=list(map(str,input().split()))
    if s[1]=="AC" and a[int(s[0])-1]==0:
        a[int(s[0])-1]+=1
    elif s[1]=="AC" and a[int(s[0])-1]==1:
        pass
    elif s[1]=="WA" and a[int(s[0])-1]==0:
        b+=1
    
    
print(a.count(1),b)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
ac = [L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]]
print(0, 0)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
ac = [L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]]

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
a=[]
b=0
for i in range(M):
    s=list(map(str,input().split()))
    if s[1]=="AC" and (int(s[0]) in a):
        pass
    elif s[1]=="AC" and (int(s[0]) not in a):
        a.append(int(s[0]))
        
    if s[1]=="WA" and (int(s[0]) not in a):
        b+=1

print(len(a),b)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
a=0
b=0
for i in range(M):
    s=list(map(str,input().split()))
    if s[1]=="AC" and int(s[0]) ==a:
        pass
    elif s[1]=="AC" and int(s[0]) >a:
        a+=1
        
    if s[1]=="WA" and int(s[0]) >a:
        b+=1

print(a,b)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
a=[]#正解した問題一覧
b=0
for i in range(M):
    s=list(map(str,input().split()))
    if s[1]=="AC" and int(s[0]) in a:
        pass
    elif s[1]=="AC" and int(s[0]) not in a:
        a.append(int(s[0]))
        
    if s[1]=="WA" and int(s[0]) not in a:
        b+=1

print(len(a),b)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac_list = [0]*n
wa_list = [0]*n
for i in range(m):
    p,s = input().split()
    if s == 'AC':
        ac_list[int(p)-1] =1
        
    if s == 'WA':
        if ac_list[int(p)-1] == 0:
            wa_list[int(p)-1] += 1
            
print('{0} {1}'.format(sum(ac_list) , sum(wa_list)))

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
sp = [input().split() for i in range(m)]
#print(sp)
x = [0] * n #正解記録リスト
y = [-1] * n
z = 0 #ペナルティ数カウンター

#正解した問題の情報について見ていく
for i in range(m):
  if sp[i][1] == "AC" : #正解の場合
    x[int(sp[i][0])-1] = 1 #xの所定の場所を1に
    y[int(sp[i][0])-1] = i #yの所定の場所をiに

#不正解だった問題の情報について見ていく
for j in range(m):
  if sp[j][1] == "WA": #不正解の場合
    if x[int(sp[j][0])-1] == 1 and j < y[int(sp[j][0])-1]: #それが正解前だったら
        z = z + 1 #ペナルティとしてカウント

print(x.count(1), z)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
sp = [input().split() for i in range(m)]
print(sp)
x = [[0, 0]] * n  #正解記録リスト
y = 0 #ペナルティ数カウンター

for i in range(m):
  z = int(sp[i][0]) #問題No取得
  if sp[i][1] == "AC": #正解の場合
    x[z-1][0] = 1 #正解リストを0から1に変更
    x[z-1][1] = i #何回目でACしたか
    print(x)

for i in range(m):
  z = int(sp[i][0]) #問題No取得
  if sp[i][1] == "WA": #不正解の場合
    if x[z-1][0] == 1 and i < x[z-1][1]: #最終的に正解していて正解前だったら
      y = y + 1 #ペナルティとしてカウント

print(x.count(1), y)

Submission status: Wrong Answer

Solution code:
import collections

N, M = map(int, input().split())
dic = {i+1:[] for i in range(N)}
for i in range(M):
    x, y = input().split()
    dic[int(x)].append(y)
    
ac = 0
cnt = 0
for key in dic.keys():
    tmp = 0
    for i in range(len(dic[key])):
        if(dic[key][i] == "AC"):
            ac += 1
            break
        tmp += 1
    if(ac >= 1):
        cnt += tmp
print(ac, cnt)

Submission status: Wrong Answer

Solution code:
import collections

N, M = map(int, input().split())
dic = {i+1:[] for i in range(N)}
for i in range(M):
    x, y = input().split()
    dic[int(x)].append(y)
    
ac = 0
cnt = 0
for key in dic.keys():
    for i in range(len(dic[key])):
        if(dic[key][i] == "AC"):
            ac += 1
            break
        cnt += 1
    if(ac < 1):
        cnt = 0
print(ac, cnt)

Submission status: Wrong Answer

Solution code:
import collections

N, M = map(int, input().split())
dic = {i+1:[] for i in range(N)}
for i in range(M):
    x, y = input().split()
    dic[int(x)].append(y)
    
ac = 0
cnt = 0
for key in dic.keys():
    for i in range(len(dic[key])):
        if(dic[key][i] == "AC"):
            ac += 1
            break
        cnt += 1
print(ac, cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
AC=WA=0
p=set()
for _ in range(M):
    a,S = input().split()
    if a not in p:
        if S=='AC':
            AC+=1
            p.add(a)
        else:
            WA+=1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n, m = map(int,input().split())
sp = [input().split() for i in range(m)]
x = [0] * n  #正解リスト
y = 0 #ペナルティ数

for i in range(m):
  if sp[i][1] == "WA":
    z = int(sp[i][0])
    if x[z-1] == 0:
      y = y + 1

  elif sp[i][1] == "AC":
    z = int(sp[i][0])
    x[z-1] = 1

print(x.count(1), y)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    solved = [False]*N
    WA = 0
    for i in range(M):
        if not solved[p[i]-1]:
            if S[i] == "WA":
                WA += 1
            else:
                solved[p[i]-1] = True
    print(len(list(filter(lambda x: x, solved))), WA)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

AC = [False for _ in range(N)]
n_AC = 0
n_WA = 0
for i in range(M):
    if AC[p[i] - 1]:
        pass
    else:
        if S[i] == "AC":
            AC[p[i] - 1] = True
            n_AC += 1
        else:
            n_WA += 1

print(" ".join([str(n_AC), str(n_WA)]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=0
wa=0
acnum=""

for _ in range(m):
  p,s=input().split()
  if acnum==p:
    pass
  else:
    if s=="AC":
      ac+=1
      acnum=p
    else:
      wa+=1
      
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=0
wa=0
account=0
acnum=""

for _ in range(m):
  p,s=input().split()
  if acnum==p and account==1:
    pass
  else:
    if s=="AC":
      ac+=1
      account=1
      acnum=p
    else:
      wa+=1
      
print(ac,wa)

Submission status: Wrong Answer

Solution code:
def resolve():
    N, M = map(int, input().split())
    complete = [False] * (N + 1)
    ac = 0
    wc = 0
    for _ in range(M):
        p, ans = input().split()
        p = int(p)
        if complete[p]:
            continue
        if ans == 'AC':
            complete[p] = True
            ac += 1
        else:
            wc += 1
    print(ac, wc)
resolve()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[]
for i in range(m):
    p=input().split()
    p=tuple(p)
    l.append(p)
k=0
s=0
l2=[]
for j in range(len(l)):
    if l[j][1]=="AC" and l[j] not in l2 :
        k+=1
    if l[j][1]!=l[j-1][1] and l[j][1]=="AC":
        s+=1
    v = l2.append(l[j])
print(k,s)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[]
for i in range(m):
    p=input().split()
    p=tuple(p)
    l.append(p)
k=0
s=0
l2=[]
for j in range(len(l)):
    if l[j][1]=="AC" and l[j] not in l2 :
        k+=1
    if l[j][1]!=l[j-1][1] and l[j][1]=="AC" and j!=0:
        s+=1
    v = l2.append(l[j])
print(k,s)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = []
accnt = 0
wacnt = 0
for i in range(m):
  p,s = input().split()
  if int(p) not in ans:
    if s == "AC":
      ans.append(int(p))
      accnt += 1
    else:wacnt += 1
print(accnt,wacnt)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
AC =[0]*(N+1)
WA =[0]*(N+1)

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

for m in range(N+1):
    if AC[m]==0:
        WA[m]=0
print(sum(WA),sum(AC))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    PS = [list(input(_).split()) for _ in range(M)]
#    PS = [list(int(a),b) for a, b in PS]
    CNT = [0] * N
    PENA = [0] * N
    for p, s in PS:
        p = int(p)
        if s == "AC": CNT[p-1] = 1
        else:
            if CNT[p-1] == 0:
                PENA[p-1] += 1
    print(sum(CNT),sum(PENA))

main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    PS = [list(input(_).split()) for _ in range(M)]
#    PS = [list(int(a),b) for a, b in PS]
    CNT = [0] * N
    PENA = [0] * N
    for p, s in PS:
        p = int(p)
        if s == "AC": CNT[p-1] = 1
        else:
            if CNT[p-1] != 1:
                PENA[p-1] += 1
    print(sum(CNT),sum(PENA))

main()

Submission status: Wrong Answer

Solution code:
N,M = [int(i) for i in input().split()]
ACed_list = []
AC_count = 0
WA_count = 0
for i in range(M) :
    p,S = input().split()
    if (p in ACed_list) :
        # ACしてたらどうでもよし
        continue
    elif (S == "AC") :
        # 初AC
        AC_count += 1
        ACed_list.append(p)
    elif (S == "WA") :
        # ACしてないのにWA
        WA_count += 1


print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
N,M = (int(x) for x in input().split())

cnt_ac = [0]*N
cnt_wa = [0]*N
for i in range(M):
  p_i,S_i = (x for x in input().split())
  p_i = int(p_i)
  
  if S_i == 'AC' and cnt_ac[p_i-1] == 0:
    cnt_ac[p_i-1] += 1
    
  elif S_i == 'WA' and cnt_ac[p_i-1] == 0:
    cnt_wa[p_i-1] += 1
    
print(sum(cnt_ac),sum(cnt_wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
 
arS = [False] * (n+1)
 
score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
	if (res == "WA"): 
		penalty = penalty + 1
        
print(score, penalty)

Submission status: Wrong Answer

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

arS = [False] * (n+1)

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
	if (res == "WA") and (arS[id]==False): 
		penalty = penalty + 1
        
print(score, penalty)

Submission status: Wrong Answer

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

arS = [False] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
#	print(id, res)
#	print(type(id),type(res))
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
#		print("True")
		score = score+1
#		print(score)
	if (res == "WA") and (arS[id]==False): 
		penalty = penalty + 1
        
print(score, penalty)

Submission status: Wrong Answer

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

arS = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA" and arS[id]==0: 
		penalty = penalty + 1
print(score, penalty)

Submission status: Wrong Answer

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

arS = [0] * 100000

score = 0
penalty = 0

for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score + 1
	if res =="WA" and arS[id]==0: 
		penalty = penalty + 1
print(score, penalty)

Submission status: Wrong Answer

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

arS = [0] * 100
#arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA": 
#		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)

Submission status: Wrong Answer

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

arS = [0] * 100000
#arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA" and arS[id]==0: 
#		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)

Submission status: Wrong Answer

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

arS = [0] * 100000
#arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA": 
#		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)

Submission status: Wrong Answer

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

arS = [0] * 100000
arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA": 
		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N,M = map(int,input().split())
AC_dict = defaultdict(int)
ans_AC = 0
ans_WA = 0

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == "WA" and AC_dict[p] != -1:
        ans_WA += 1
    elif s == "AC" and AC_dict[p] != -1:
        ans_AC += 1
        AC_dict[p] = -1
    elif (s == "AC" or s == "WA") and AC_dict[p] == -1:
        continue
print(ans_AC,ans_WA)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N,M = map(int,input().split())
AC_dict = defaultdict(int)
ans_AC = 0
ans_WA = 0

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == "WA" and AC_dict[p] != -1:
        ans_WA += 1
    elif s == "AC" and AC_dict[p] != -1:
        ans_AC += 1
        AC_dict[p] = -1
print(ans_AC,ans_WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = []
S = []
ans_AC = 0
ans_WA = 0
for i in range(M):
    p,s = input().split()
    p = int(p)
    P.append(p)
    S.append(s)
Ps = list(set(P))

for i in range(M):
    if P[i] in Ps and S[i] == "AC":
        ans_AC += 1
        index = Ps.index(P[i])
        Ps[index] = 0
    elif P[i] in Ps and S[i] == "WA":
        ans_WA += 1

print(ans_AC,ans_WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
submit = [list(input().split()) for _ in range(M)]
acflag = [False]*N
AC = 0
WA = 0

for i in range(M):
    if (not acflag[int(submit[i][0])-1]) and submit[i][1] == "AC":
        acflag[int(submit[i][0])-1] = True
        AC += 1
    elif (not acflag[int(submit[i][0])-1]) and submit[i][1] == "WA":
        WA += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
submit = [list(input().split()) for _ in range(M)]
acflag = [False]*N
AC = 0
WA = 0

for i in range(M):
    if not acflag[int(submit[i][0])-1] and submit[i][1] == "AC":
        acflag[int(submit[i][0])-1] = True
        AC += 1
    elif not acflag[int(submit[i][0])-1] and submit[i][1] == "WA":
        WA += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ac=[0]*N
AC=0
WA=0
for i in range(M):
  lst=list(map(str,input().split()))
  n=int(lst[0])-1
  if lst[1]=='WA':
    if ac[n]:
      pass
    else:
      WA+=1
  else:
    if ac[n]:
      pass
    else:
      ac[n]=1
      AC+=1
print(' '.join([str(AC),str(WA)]))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
AC = [0] * (n+1)
WA = [0] * (n+1)

for j in range(m):
    p,s = input().split()
    p = int(p)

    if s == 'AC':
        AC[p] = 1
    elif s == 'WA'and AC[p] != 1:
        WA[p] += 1

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

Submission status: Wrong Answer

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

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

    if s == 'AC':
        AC[p] = 1
    elif s == 'WA'and AC[p] != 1:
        WA[p] += 1

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

Submission status: Wrong Answer

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

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

    if s == 'AC':
        AC[p] = 1
    elif AC[p] != 1:
        WA[p] += 1

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

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac_count = 0
wa_count = 0
ac_list = []
for j in range(m):
    p,s = input().split()
    if s == 'WA'and (not p in ac_list):
        wa_count = wa_count + 1
    elif s == 'AC' and (not p in ac_list):
        ac_count = ac_count + 1
        ac_list.append(p)

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac_count = 0
wa_count = 0
ac_list = []
for j in range(m):
    p,s = input().split()
    if s == 'WA'and not p in ac_list:
        wa_count = wa_count + 1
    elif not p in ac_list:
        ac_count = ac_count + 1
        ac_list.append(p)

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p = [0 for _ in range(m)]
s = ['' for _ in range(m)]
ac_count = 0
wa_count = 0
ac_list = []
for j in range(m):
    p[j], s[j] = input().split()

for i in range(m):
    if s[i] == 'WA'and not p[i] in ac_list:
        wa_count = wa_count + 1
    elif not p[i] in ac_list:
        ac_count = ac_count + 1
        ac_list.append(p[i])

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p = [0 for _ in range(m)]
s = ['' for _ in range(m)]
ac_count = 0
wa_count = 0
ac_list = []
for j in range(m):
    p[j], s[j] = input().split()

for i in range(m):
    if s[i] == 'WA' and p[i-1] != p[i]:
        wa_count = wa_count + 1
    elif not p[i] in ac_list:
        ac_count = ac_count + 1
        ac_list.append(p[i])

print(ac_count, wa_count)

Submission status: Wrong Answer

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

    for _ in range(m):
        p, s = map(str, input().split())
        p = int(p) - 1
        if ac[p] == 0 and s == 'WA':
            pena[p] += 1
        else:
            ac[p] = 1
    print(sum(ac), sum(pena))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    for _ in range(m):
        p, s = map(str, input().split())
        p = int(p) - 1
        if ac[p] == 0 and s == 'WA':
            pena[p] += 1
        else:
            ac[p] = 1
    print()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder

N, M = map(int, input().split())
AC = [0]*N
WA = [0]*N

for i in range(M):
    p, S = map(str, input().split())
    if AC[int(p)-1]==0:
        if S=='AC':
            AC[int(p)-1] = 1
        else:
            WA[int(p)-1] += 1

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
L=[0]*N
A=0
W=0
tmp=0
for i in range(M):
	x,y=input().split()
	t=int(x)
	if L[t-1]==0:
		if y=="WA":
			tmp+=1
		else:
			A+=1
			W+=tmp
			tmp=0
			L[t-1]=1
print(A,W)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
L=[0]*N
A=0
W=0
tmp=0
for i in range(M):
	x,y=input().split()
	t=int(x)
	if L[t-1]==0:
		if y=="WA":
			tmp+=1
			W+=1
		else:
			A+=1
			W+=tmp
			tmp=0
			L[t-1]=1
print(A,W)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
L=[0]*N
A=0
W=0
for i in range(M):
	x,y=input().split()
	t=int(x)
	if L[t-1]==0:
		if y=="WA":
			W+=1
		else:
			A+=1
			L[t-1]=1
print(A,W)

Submission status: Wrong Answer

Solution code:
from sys import stdin

lines = stdin.readlines()
n, m = [int(x) for x in lines[0].rstrip().split()]
ps_dict = {}
for i in range(1, m + 1, 1):
    ps_dict.update({i:lines[i].rstrip().split()})

acs = [0] * n
was = [0] * n

for key in ps_dict:
    if 0 == acs[int(ps_dict[key][0])-1]:
        if str(ps_dict[key][1]) == 'WA':
            was[int(ps_dict[key][0])-1] = was[int(ps_dict[key][0])-1] + 1
        else:
            acs[int(ps_dict[key][0])-1] = acs[int(ps_dict[key][0])-1] + 1

print(str(sum(acs)) + ' ' + str(sum(was)), flush=True)

Submission status: Wrong Answer

Solution code:
from sys import stdin

lines = stdin.readlines()
n, m = [int(x) for x in lines[0].rstrip().split()]
ps_dict = {}
for i in range(1, m + 1, 1):
    ps_dict.update({i:lines[i].rstrip().split()})

acs = [0] * n
was = [0] * n

for key in ps_dict:
    if 0 == acs[int(ps_dict[key][0])-1]:
        if str(ps_dict[key][1]) == 'WA':
            was[int(ps_dict[key][0])-1] = was[int(ps_dict[key][0])-1] + 1
        else:
            acs[int(ps_dict[key][0])-1] = acs[int(ps_dict[key][0])-1] + 1

print(str(sum(acs)) + ' ' + str(sum(was)))

Submission status: Wrong Answer

Solution code:
from sys import stdin

lines = stdin.readlines()
n, m = [int(x) for x in lines[0].rstrip().split()]
ps_dict = {}
for i in range(1, m + 1, 1):
    ps_dict.update({i:lines[i].rstrip().split()})

acs = [0] * n
was = [0] * n

for key in ps_dict:
    if 0 == acs[int(ps_dict[key][0])-1]:
        if str(ps_dict[key][1]) == 'WA':
            was[int(ps_dict[key][0])-1] = was[int(ps_dict[key][0])-1] + 1
        else:
            acs[int(ps_dict[key][0])-1] = acs[int(ps_dict[key][0])-1] + 1

print('%d %d'%(sum(acs), sum(was)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ac_set = set()

penalty_total = 0
penalty_map = {}

for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == "AC":
    ac_set.add(p)
    penalty_total += penalty_map.get(p, 0)
  elif p not in ac_set:
    if p not in penalty_map:
      penalty_map[p] = 1
    else:
      penalty_map[p] += 1

print(len(ac_set), penalty_total)

Submission status: Wrong Answer

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

ac_set = set()
penalty_count = 0
for _ in range(M):
  p, s = input().split()
  if s == "AC":
    ac_set.add(p)
  elif p not in ac_set:
    penalty_count += 1

print(len(ac_set), penalty_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
d = {}
cl_cnt = 0
pl_cnt = 0
for i in ps:
  if int(i[0]) in d:
    if (d[int(i[0])] == 'WA') and (i[1] == 'WA'):
      pl_cnt += 1
      if pl_cnt == m:
        pl_cnt = 0
    elif (d[int(i[0])] == 'WA') and (i[1] == 'AC'):
      cl_cnt += 1
      d[int(i[0])] = 'AC'
  else:
    d[int(i[0])] = i[1]
    if i[1] == 'WA':
      pl_cnt += 1
    else:
      cl_cnt += 1
print(cl_cnt,pl_cnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
d = {}
cl_cnt = 0
pl_cnt = 0
for i in ps:
  if int(i[0]) in d:
    if (d[int(i[0])] == 'WA') and (i[1] == 'WA'):
      pl_cnt += 1
    elif (d[int(i[0])] == 'WA') and (i[1] == 'AC'):
      cl_cnt += 1
      d[int(i[0])] = 'AC'
  else:
    d[int(i[0])] = i[1]
    if i[1] == 'WA':
      pl_cnt += 1
    else:
      cl_cnt += 1
print(cl_cnt,pl_cnt)

Submission status: Wrong Answer

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

stop_set=set()

WA_count=0
AC_count=0
for el in lst:
    if not el[0] in stop_set:
        if el[1]=='AC':
            AC_count+=1
            stop_set.add(el[0])
        else:
            WA_count+=1
print(AC_count, WA_count)

Submission status: Wrong Answer

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

stop_set=set()

WA_count=0
AC_count=0
for i in range(M):
    if not lst[i][0] in stop_set:
        if lst[i][1]=='AC':
            AC_count+=1
            stop_set.add(lst[i][0])
        else:
            WA_count+=1
print(AC_count, WA_count)

Submission status: Wrong Answer

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

stop_list=[]

WA_count=0
AC_count=0
for i in range(M):
    if not lst[i][0] in stop_list:
        if lst[i][1]=='AC':
            AC_count+=1
            stop_list.append(lst[i][0])
        else:
            WA_count+=1
print( AC_count, WA_count)