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())
l=[]
cnt_WA=0
cnt_AC=0
for i in range(m):
    s=list(map(str,input().split()))
    #print(s)
    l.append(s)
for j in range(m-1):
    if int(l[j][0])==int(l[j+1][0]):
        if l[j][1]=='WA' :
            #print('WAl[j][0]',l[j][0])
            cnt_WA +=1
            if l[j+1][1]=="AC":
                #print('ACl[j][0]',l[j][0])
                cnt_AC +=1
                
        if l[j-1][1]!="WA" and l[j][1]=="AC":
            cnt_AC +=1
            #print('PACl[j][0]',l[j][0])
            break

print(cnt_AC,cnt_WA)

Submission status: Wrong Answer

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

WA_count = 0
AC_count = 0
Penal = 0
d = {}

for i in range(1, M+1):
    p, S = list(map(str, input().split()))
    if S == "WA":
        WA_count += 1
    else:
        if p not in d.keys():
            d[p] = WA_count
            WA_count = 0
        else:
            WA_count = 0
        # cor.append(p)
        # if AC_count != set(cor):
        #     AC_count = set(cor)
        #     Penal += WA_count
        #     WA_count = 0
        # else:
        #     WA_count = 0

print(len(d), sum(d.values()))

Submission status: Wrong Answer

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

WA_count = 0
AC_count = 0
Penal = 0
d = {}

for i in range(1, M+1):
    p, S = list(map(str, input().split()))
    if S == "WA":
        WA_count += 1
    else:
        if p not in d.keys():
            d[p] = WA_count
            WA_count = 0
        # cor.append(p)
        # if AC_count != set(cor):
        #     AC_count = set(cor)
        #     Penal += WA_count
        #     WA_count = 0
        # else:
        #     WA_count = 0

print(len(d), sum(d.values()))

Submission status: Wrong Answer

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

WA_count = 0
AC_count = 0
Penal = 0
cor = []

for i in range(1, M+1):
    p, S = list(map(str, input().split()))
    if S == "WA":
        WA_count += 1
    else:
        cor.append(p)
        if AC_count != set(cor):
            AC_count = set(cor)
            Penal += WA_count
            WA_count = 0
        else:
            WA_count = 0

print(len(set(cor)), Penal)

Submission status: Wrong Answer

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

count = 0
Penal = 0
sub = []

for i in range(M):
    p, S = list(map(str, input().split()))
    if S == "WA":
        count += 1
    else:
        sub.append(p)
        Penal += count
        count = 0

print(len(set(sub)), Penal)

Submission status: Wrong Answer

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

count = 0
Penal = 0
sub = []

for i in range(M):
    p, S = list(map(str, input().split()))
    sub.append(p)
    if S == "WA":
        count += 1
    else:
        Penal += count
        count = 0

print(len(set(sub)), Penal)

Submission status: Wrong Answer

Solution code:
import sys
n,m = map(int,input().split())
ma = [list(input().split()) for _ in range(m)]
if len(ma) == 0:
    print(0,0)
    sys.exit()
#print(ma)
#[['1', 'WA'], ['1', 'AC'], ['2', 'WA'], ['2', 'AC'], ['2', 'WA']]

li = [[False,0,0] for _ in range(n)]
#print(li) 
#[[False, 0, 0], [False, 0, 0]]

ok_count = 0
ng_count = 0
for m in ma:
    ind = int(m[0])-1
    st =  m[1]
    if st == 'WA' and li[ind][0] == False:
        ng_count += 1
    elif st == 'AC' and li[ind][0] == False:
        ok_count += 1
        li[ind][0] = True

print(ok_count,ng_count)

Submission status: Wrong Answer

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

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

for i in range(m):
    a,b=input().split()
    a=int(a)-1
    if not ac[a]:
        if b=="WA":
            wa[a]+=1
        else:
            ac[a]=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans={}
for i in range(M):
    p,S=map(str,input().split())
    ans.setdefault(p,[]).append(S)

ac=0
wa=0

for i in ans.keys():
    for j in ans[i]:
        if j=="WA":
            wa+=1
        elif j=="AC":
            ac+=1
            break
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, sys.stdin.readline().split())
pv = []
for _ in range(m):
    p, s = sys.stdin.readline().split()
    p = int(p) - 1
    v = 1 if s == 'AC' else 0
    pv.append((p, v))

def main():
    wa = [0] * n
    ac = [0] * n
    for p, c in pv:
        wa[p] += (ac[p] | v) ^ 1
        ac[p] |= v
    for p in range(n): wa[p] *= ac[p]
    print(sum(ac), sum(wa))

if __name__ ==  '__main__':
    main()

Submission status: Wrong Answer

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

flag_correct = [False]*(n+1)
count_correct = 0
count_pena = 0
for i,ans in enumerate(list_pS):
  if ans[1] == 'AC':
    if not(flag_correct[int(ans[0])]):
      count_correct +=1 
      flag_correct[int(ans[0])] = True
  if ans[1] == 'WA':
    if not(flag_correct[int(ans[0])]):
      count_pena +=1
#print(flag_correct)
print(count_correct, count_pena)

Submission status: Wrong Answer

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, m = MI()

ac = 0
wa = 0
acp = {}
for i in range(m):
    id, result = MS()
    
    if result == "WA":
        if id in acp:
            continue
        wa += 1
    else:
        if id in acp:
            continue
        acp[id] = True
        ac += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
def myAnswer(N:int,M:int,p:list,S:list) -> None:
   ac = 0
   wa = 0
   lis = [i for i in range(1,N+1)]
   for n,v in zip(p,S):
      if(int(n) in lis):
         if(v == "AC"):
            lis.remove(int(n))
            ac+=1
         else:
            wa += 1
   print(ac,wa)

def modelAnswer():
   tmp=1
def main():
   N, M = map(int,input().split())
   p =[]
   S = []
   for _ in range(M):
      tmp = list(map(str,input().split()))
      p.append(tmp[0])
      S.append(tmp[1])
   myAnswer(N,M,p[:],S[:])
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
def myAnswer(N:int,M:int,p:list,S:list) -> None:
   ac = 0
   wa = 0
   dic = {}
   for key,value in zip(p,S):
      if(key in dic.keys()):
         dic[key].append(value)
      else:
         dic[key] = [value]
   for values in dic.values():
      for v in values:
         if(v == "AC"):
            ac+=1
            break
         else:
            wa+=1
   print(ac,wa)

def modelAnswer():
   tmp=1
def main():
   N, M = map(int,input().split())
   p =[]
   S = []
   for _ in range(M):
      tmp = list(map(str,input().split()))
      p.append(tmp[0])
      S.append(tmp[1])
   myAnswer(N,M,p[:],S[:])
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
solve_problem = []
penalty = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC' and p not in solve_problem:
        solve_problem.append(p)
    if S == 'WA' and p not in solve_problem:
        penalty += 1

print('{} {}'.format(len(solve_problem), penalty))

Submission status: Wrong Answer

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

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

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

print(ac, wa)

Submission status: Wrong Answer

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

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

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

print(ac, wa)

Submission status: Wrong Answer

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

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

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

print(ac, wa)

Submission status: Wrong Answer

Solution code:
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''
N,M = map(int,input().split())
sub = [ -1 for _ in range(N) ]
penalty = 0
score = 0
for _ in range(M):
	p , s = map(str,input().split())
	p = int(p)
	if s=='WA':
		if sub[p-1]==-1 or sub[p-1]==0:
			sub[p-1]=0
			penalty+=1
	elif s=='AC':
		if sub[p-1]==0 or sub[p-1]==-1:
			sub[p-1]=1
			score+=1
print(score,penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ACs=[]
w=0
for i in range(M):
    p,s=input().split()
    if s=='AC':
        if p not in ACs:
            ACs.append(p)
    else:
        if p not in ACs:
            w+=1
print(len(ACs),w)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ACs=[]
WAs=0
for i in range(M):
    p,s=input().split()
    if p not in ACs:
        if s=='AC':
            ACs.append(p)
        else:
            WAs+=1
print(len(set(ACs)),WAs)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ACs=[]
WAs=0
for i in range(M):
    p,s=input().split()
    if int(p) not in ACs:
        if s=='AC':
            ACs.append(int(p))
        else:
            WAs+=1
print(len(set(ACs)),WAs)

Submission status: Wrong Answer

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

clear = []
ac = 0
wa = 0

for i in range(m):
    p, s = input().split()
    if not p in clear:
        if s == 'WA':
            wa += 1
        elif s == 'AC':
            ac += 1
            clear.append(p)

print(ac, wa)

Submission status: Wrong Answer

Solution code:
num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]

for i in range(all_ans):
    ans_num, ac_wa = [i for i in input().split(" ")]
    if d_ac[int(ans_num) - 1] == 1: continue
    if ac_wa == "AC": 
        d_ac[int(ans_num) - 1] = 1
        continue
    if ac_wa == "WA":
        d_wa[int(ans_num) - 1] += 1
        continue

print(sum(d_ac),sum(d_wa))

Submission status: Wrong Answer

Solution code:
num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]

for i in range(all_ans):
    ans_num, ac_wa = [i for i in input().split(" ")]
    print(d_ac, d_wa)
    if d_ac[int(ans_num) - 1] == 1: continue
    if ac_wa == "AC": 
        d_ac[int(ans_num) - 1] = 1
        continue
    if ac_wa == "WA":
        d_wa[int(ans_num) - 1] += 1
        continue

print(sum(d_ac),sum(d_wa))

Submission status: Wrong Answer

Solution code:
num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]

for i in range(all_ans):
    num, ac_wa = [i for i in input().split(" ")]
    if d_ac[int(num) - 1] == 1: continue
    if ac_wa == "AC":
        d_ac[int(num) - 1] = 1
    else:
        d_wa[int(num) - 1] += 1

print(sum(d_ac),sum(d_wa))

Submission status: Wrong Answer

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

def main():
     n, m = map(int, input().split())
     ac_list = [0 for i in range(n)]
     wa_list = [0 for i in range(n)]

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input().split() for i in range(m)]
AC = [False for i in range(n)]
WA = 0
for i in ps:
    if AC[int(i[0]) - 1]:
        pass
    else:
        if i[1] == "AC":
            AC[int(i[0]) - 1] = True
        else:
            WA += 1
print(AC.count(True), WA)

Submission status: Wrong Answer

Solution code:
import sys
a,b=map(int,input().split())
account=0
wacount=0
acbox=[0]*(a+1)
wabox=[0]*(a+1)
for i in range(b):
  p,q=input().split()
  p=int(p)
  if q=="WA":
    if acbox[p]==0:
      wabox[p]+=1
  else:
    if acbox[p]!=0:
      account+=1
      wacount+=wabox[p]
      acbox[p]=+1
print(account,wacount)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
p = [0]*M
S = [0]*M
cnt_penalty = [0]*N
cnt_ac = [0]*N

for i in range(M):
  p[i], S[i] = input().split()
  p[i] = int(p[i])
    
for i in range(M):
  if cnt_ac[p[i]-1] == 0:
    if S[i] == "WA":
      cnt_penalty[p[i]-1] += 1
    elif S[i] == "AC":
      cnt_ac[p[i]-1] = 1
    
print(sum(cnt_ac), sum(cnt_penalty))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
List=[list(input().split()) for i in range(b)]
account=0
wacount=0
acbox=[0]*(a+1)
for i in List:
  if i[1]=="WA":
    if acbox[int(i[0])]==0:
      wacount+=1
  else:
    if acbox[int(i[0])]==0:
      acbox[int(i[0])]=1
      account+=1
print(account,wacount)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
p = [0]*M
S = [0]*M
cnt_penalty = [0]*N
cnt_ac = [0]*N

for i in range(M):
  p[i], S[i] = input().split()
  p[i] = int(p[i])
    
for i in range(M):
  if cnt_ac[p[i]-1] != 1:
    if S[i] == "WA":
      cnt_penalty[p[i]-1] += 1
    else:
      cnt_ac[p[i]-1] = 1
    
print(sum(cnt_ac), sum(cnt_penalty))

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
p = [0]*M
S = [0]*M
cnt_penalty = [0]*N
cnt_ac = 0

for i in range(M):
  p[i], S[i] = input().split()
  p[i] = int(p[i])
    
for i in range(N):
  for j in range(M):
    if p[j] == i+1 and S[j] == "WA":
      cnt_penalty[i] += 1
      
    elif p[j] == i+1 and S[j] == "AC":
      cnt_ac += 1
      break
    
print(cnt_ac, sum(cnt_penalty))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
List=[list(input().split()) for i in range(b)]
account=0
wacount=0
acbox=[0]*(a+1)
for i in List:
  if i[1]=="WA":
    if acbox[int(i[0])]==1:
      continue
    else:
      wacount+=1
  else:
    if acbox[int(i[0])]==1:
      continue
    else:
      acbox[int(i[0])]+=1
      account+=1
print(account,wacount)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
List=[list(input().split()) for i in range(b)]
account=0
wacount=0
acbox=[]
for i in List:
  if i[1]=="WA":
    if int(i[0]) in acbox:
      continue
    else:
      wacount+=1
  else:
    if int(i[0]) in acbox:
      continue
    else:
      acbox.append(int(i[0]))
      account+=1
print(account,wacount)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
List=[list(input().split()) for i in range(b)]
for i in range(b):
  List[i][0]==int(List[i][0])
p=set()
account=0
wacount=0
acbox=[]
for i in List:
  if i[1]=="WA":
    if i[0] in acbox:
      continue
    else:
      wacount+=1
  else:
    if i[0] in acbox:
      continue
    else:
      acbox.append(i[0])
      account+=1
print(account,wacount)

Submission status: Wrong Answer

Solution code:
N,M = [int(v) for v in input().split()]
wa_total = [0 for _ in range(N)]
ac_flag = [False for _ in range(N)]

for _ in range(M):
    p,ans = [v for v in input().split()]
    p = int(p) - 1

    if not ac_flag[p]:
        if ans == "AC":
            ac_flag[p] = True
        else:
            wa_total[p] += 1

print(sum(ac_flag),sum(wa_total))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = set()
npena = 0
for i in range(m):
    np, res = input().split()
    if res == 'AC':
        ac.add(np)
    else:
        if np not in ac:
            npena += 1
print(len(ac), npena)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l = [input().split() for _ in range(m)]
ac = 0
wa = 0
for i in range(m):
    l[i][0] = int(l[i][0])
for i in range(m):  
    if l[i] == 'x':
        continue
    elif l[i][1] == 'WA':
        wa += 1
    elif l[i][1] == 'AC':
        l = ['x' if _ == l[i] or _ == [l[i][0], 'WA'] else _ for _ in l]
        ac += 1
        m -= (m - len(l))
print(ac, wa)

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    ary = [input().split() for _ in range(m)]
    cnt_ac = 0
    cnt_wa = 0
    ac_ary = [0] * n
    for toi_num, kekka in ary:
        if ac_ary[int(toi_num) - 1] == 0:
            if kekka == 'WA':
                cnt_wa += 1
            else:
                ac_ary[int(toi_num) - 1] = 1
                cnt_ac += 1
    print(cnt_ac, cnt_wa)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(str,input().split()))





N,M=input2()
ps=[]
for _ in range(M):
	ps.append(input_array())
ans_dict={i:False for i in range(N)}
ans_list=[0]*N


wa=0


for x in ps:
	num=int(x[0])-1
	ans=x[1]
	if ans_dict[num] ==True:
		continue
	elif ans=="WA" and ans_dict[num]==False:
		wa+=1
	elif ans=="AC" and ans_dict[num]==False:
		ans_dict[num]=True
		ans_list[num]=1

print(sum(ans_list),wa)

Submission status: Wrong Answer

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(str,input().split()))





N,M=input2()
ps=[]
for _ in range(M):
	ps.append(input_array())
ans_dict={i:False for i in range(1,N+1)}
ans_list=[0]*(N+1)


wa=0


for x in ps:
	num=int(x[0])
	ans=x[1]
	if ans=="WA" and ans_dict[num]==False:
		wa+=1
	elif ans=="AC" and ans_dict[num]==False:
		ans_dict[num]=True
		ans_list[num]=1
print(sum(ans_list),wa)

Submission status: Wrong Answer

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(str,input().split()))





N,M=input2()
ps=[]
for _ in range(M):
	ps.append(input_array())
ans_dict={i:False for i in range(1,N+1)}
ans_list=[0]*(N+1)

ac=0
wa=0
b_ans=-1
b_num=-1

for x in ps:
	num=int(x[0])
	ans=x[1]
	if ans=="WA" and ans_dict[num]==False:
		wa+=1
	else:
		ans_dict[num]=True
		ans_list[num]=1
print(sum(ans_list),wa)

Submission status: Wrong Answer

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(str,input().split()))





N,M=input2()
ps=[]
for _ in range(M):
	ps.append(input_array())
ex_dict={}

ac=0
wa=0
b_ans=-1
b_num=-1
for x in ps:
	num=int(x[0])
	ans=x[1]
	if ans=="WA":
		if b_num==num and b_ans!=ans:
			#waがカウントされない場合
			continue
		else:
			wa+=1

	else:
		if b_num==num and b_ans==ans:
			#acがカウントされない場合
			continue
		else:
			ac+=1
	b_num=num
	b_ans=ans
print(ac,wa)

Submission status: Wrong Answer

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(str,input().split()))





N,M=input2()
ps=[]
for _ in range(M):
	ps.append(input_array())
ex_dict={}

ac=0
wa=0
b_ans=-1
b_num=-1
for x in ps:
	num=int(x[0])
	ans=x[1]
	if ans=="WA":
		if b_num==num and b_ans!=ans:
			continue
		else:
			wa+=1

	elif ans=="AC":
		if b_num==num and b_ans==ans:
			continue
		else:
			ac+=1
	b_num=num
	b_ans=ans
print(ac,wa)

Submission status: Wrong Answer

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

N = a[0]
M = a[1]

AC = [0] * N #ACの問題番号を1にする i = id -1
WA = [0] * N #WAの回数を入れる

for i in range(M):
    a = list(map(str,input().split()))
    id_num = int(a[0])-1
    if AC[id_num] == 1:
        continue
    elif a[1] == 'WA':
        WA[id_num] += 1
    elif a[1] == 'AC':
        AC[id_num] = 1 

print('{} {}'.format(sum(AC),sum(WA)))

Submission status: Wrong Answer

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

N = a[0]
M = a[1]

AC = [0] * N #ACの問題番号を1にする i = id -1
WA = [0] * N #WAの回数を入れる

for i in range(M):
    a = list(map(str,input().split()))
    id_num = int(a[0])-1
    if AC[id_num] == 1:
        continue
    elif a[1] == 'WA':
        WA[id_num] += 1
    elif a[1] == 'AC':
        AC[id_num] += 1 

print('{} {}'.format(sum(AC),sum(WA)))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m==0:
  print(0,0)
else:
  p=[list(map(str,input().split())) for i in range(m)]
  q=[]
  s=[]
  t=0
  for i in range(len(p)):
    if p[i][1]=='AC':
      q.append(p[i][0])
      if p[i][0] in s:
        t+=s.count(p[i][0])
      
    elif p[i][1]=="WA":
      if not p[i][0] in q:
        s.append(int(p[i][0]))
  
  r=set(q)
  
  
  print(len(r),len(s))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,m=n1()
ps=s2(m)
OK=NG=0
d={str(i):False for i in range(1,n+1)}
for line in ps:
    num=line.split()[0]
    ans=line.split()[1]
    if d[num]==False:
        if ans=="AC":
            OK+=1
            d[num]=True
        else:
            NG+=1
print(OK,NG)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac, wa = 0, 0
p = []
for i in range(m):
    pi, si = map(str, input().split())
    if not pi in p and si=='AC':
        p.append(pi)
        ac+=1
    elif not pi in p and si!='AC':
        wa+=1
    
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int, input().split()))
 
wa = 0
ac = 0
wr = 0

correct = []

# 行数の入力
for i in range(M):
    # for文で回しつつ処理する
    p,s = input().split()
    p = int(p) 
    #  WA 回数を 1 増加
    if s == 'WA':
        wa += 1
    #  AC が初めての場合
    elif s == 'AC' and p not in correct:
        correct.append(p)
        wr = wa
    #  AC が初めてでなければ, 何もしません
    elif s == 'AC' and p in correct:
        continue

print('%s %s' % (len(correct), wr))

Submission status: Wrong Answer

Solution code:
N,M = list(map(int, input().split()))
 
wa = 0
ac = 0
wr = 0

remind = []

# 行数の入力
for i in range(M):
    # for文で回しつつ処理する
    p,s = input().split()
    p = int(p) 
    #  AC が初めてでなければ, 何もしません
    if p in remind:
        continue
    #  AC が初めての場合
    if s == 'AC' and p not in remind:
        ac += 1
        remind.append(p)
        # ペナルティが「その問題で WA が出た回数」
        wr = wa
    #  WA 回数を 1 増加
    if s == 'WA':
        wa += 1
 
print('%s %s' % (ac, wr))

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
pS = [input().split() for _ in range(m)]
pena = 0
correct = 0
flag = [False] * n
for p, s in pS:
    p = int(p)
    if flag[p-1] == True:
        continue
    else:
        if s == "WA":
            pena += 1
        elif s == "AC":
            correct += 1
            flag[p-1] = True
print(correct, pena)

Submission status: Wrong Answer

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

wa = 0
ac = 0
remind = []

# 行数の入力
for i in range(M):
    # for文で回しつつ処理する
    p,s = input().split()
    p = int(p)

    # すでにあるACスキップ
    if p in remind:
        continue
    # ACをカウント
    if s == 'AC':
        ac += 1
        remind.append(p)
    # WAをカウント
    if s == 'WA':
        wa += 1

print('%s %s' % (ac, wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
pS = [tuple(input().split()) for _ in range(m)]
pena = 0
correct = 0
flag = [False] * (10**6)
for p, s in pS:
    p = int(p)
    if flag[p-1] == True:
        continue
    else:
        if s == "WA":
            pena += 1
        else:
            correct += 1
            flag[p-1] = True
print(correct, pena)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
from functools import lru_cache

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

p = [0] * M
s = [0] * M

# 行数の入力
for i in range(M):
    p[i], s[i] = map(str, input().split())

@lru_cache(maxsize=1000)
def main():
    wa = 0
    ac = 0
    acNo = []
    for i in range(M):
        # ACをカウント
        if p[i] in acNo:
            continue
        # WAをカウント
        if s[i] == "WA":
            wa += 1
        # ACをカウント
        if s[i] == "AC" and p[i] not in acNo:
            ac += 1
            # ACを保存
            acNo.append(p[i])
    return('%s %s' % (ac, wa))

print(main())

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
pS = [tuple(input().split()) for _ in range(m)]
pena = 0
correct = 0
flag = [False] * n
for p, s in pS:
    p = int(p)
    if flag[p-1] == True:
        continue
    else:
        if s == "WA":
            pena += 1
        else:
            correct += 1
            flag[p-1] = True
print(correct, pena)

Submission status: Wrong Answer

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

AC = set()
cnt = {i: 0 for i in range(1, N + 1)}
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if (S == "AC"):
        AC.add(p)
    elif (S == "WA" and p not in AC):
        cnt[p] += 1

WA = sum([v for v in cnt.values()])
print(len(AC), WA)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
from functools import lru_cache

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

p = [0] * M
s = [0] * M

# 行数の入力
for i in range(M):
    p[i], s[i] = map(str, input().split())


@lru_cache(maxsize=1000)
def main(K):
    wa = 0
    ac = 0
    acNo = []
    for i in range(M):
        # 回答があったらスキップ
        if p[i] in acNo:
            continue
        # WAをカウント
        if s[i] == "WA":
            wa = wa + 1
        # ACをカウント
        if s[i] == "AC":
            ac = ac + 1
            # ACを保存
            acNo.append(p[i])
    return('%s %s' % (ac, wa))

print(main(M))