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())

c_l = list()
a = 0
w = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if p not in c_l:
    c_l.append(p)

Submission status: Wrong Answer

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

p = []
S = []

wa = 0
ac = 0

for i in range(M):
    P, s = list(map(str, input().split()))
    
    if s == 'WA' and (P not in p):
        wa += 1
    if s == 'AC' and (P not in p):
        ac += 1
        p.append(P)

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pS = {}
for i in range(N):
    pS[i] = [0, 0, 0]  # is_ac, penatly, AC

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

AC = 0
penatly = 0
for i in range(N):
    penatly += pS[int(i)][1]
    AC += pS[int(i)][2]
print(AC, penatly)

Submission status: Wrong Answer

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

n, m = [int(i) for i in input().split()]

submits = [0] * m
for i in range(m):
    p, s = input().split()
    submits[i] = (int(p), s.strip())

answer = [0] * (n+1)
for i in range(n):
    answer[i+1] = {'AC':0, 'WA':0}

for submit in submits:
    p, s = submit[0], submit[1]
    if s == 'WA' and answer[p]['AC'] == 0:
        answer[p][s] += 1
    if s == 'AC' and answer[p]['AC'] == 0:
        answer[p][s] += 1

ac_num = 0
wa_num = 0
for a in answer[1:]:
    ac_num += a['AC']
    wa_num += a['WA']
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = []
for a in al:
  if a[1] == 'AC':
    al_a.append(a)
r1 = len(set(al_a))
al_a2 = [i[0] for i in al_a]
r2 = 0
for j in al:
  if j[1] == 'WA' and j[0] in al_a2:
    r2 += 1
  
  
print(int(r1) ,int(r2))

Submission status: Wrong Answer

Solution code:

N, M = [int(x) for x in input().split()]
problem = [i for i in range(1, N+1)]


correct = 0
penalty = 0

ans = set([])

for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p in ans:
        continue
    elif S == 'WA':
        penalty += 1
    elif p in problem:
        correct += 1
        ans.add(p)

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[]
A=[]
for i in range(M):
    n,a=input().split()
    P.append(int(n))
    A.append(a)

D=['WA']*N
p=0
a=0
for i in range(M):
  if D[P[i]-1]=='WA':
    if A[i]=='WA':
      p+=1
    else:
      a+=1
      D[P[i]-1]='AC'

print(a,p)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
AC_list = []
WA_count = 0
AC_count = 0
for i in range(M):
    A = list(input().split())
    if A[0] in AC_list:
        pass
    else:
        if A[1] == "AC":
            AC_count += 1
            AC_list.append(A[0])
        else:
            WA_count += 1
print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = []
wa = []
for i in range(m):
  p,s = input().split()
  if s == 'AC':
    if not p in ac:
      ac.append(p)
  else:
    if not p in ac:
      wa.append(p)
print(len(ac),len(wa))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
A = [input().split() for _ in range(W)]

a=0
b=0
c=0
for i in range(W):
    if A[i][0]!=c:
        c=A[i][0]
        b+=1
        if A[i][1]=="WA":
            a+=1
print(b,a)

Submission status: Wrong Answer

Solution code:
N,M = [int(i) for i in input().split()]
submissions = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [j for j in input().split()]
    submissions[P].append(S)
for i in submissions:
    for j in submissions[i]:
        if j == 'AC':
            AC+=1
            break
        WA +=1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = 0
wa = 0
aclist = {}
for i in range(n):
    aclist[i + 1] = 0

for i in range(m):
    a,b = input().split()
    a = int(a)
    if aclist[a] == 0:
        if b == 'WA':
            wa += 1
        if b == 'AC':
            aclist[a] += 1
            ac += 1
print(ac, wa, end=" ")

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
d = []
ok = 0
ng = 0
for _ in range(m):
    p, s = input().split()
    if p not in d:
        if s == "AC":
            d.append(p)
            ok += 1
        else:
            ng += 1

print(ok, ng)

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
ans = {}
ac = "AC"
wa = "WA"
ac_num = {}
wa_num =  [] 
for _ in range(m):
  p, s = input().split()
  if s == ac:
    ac_num[p] = 1
  elif not(p in ac_num):
    wa_num.append(p)
print(len(ac_num), len((wa_num)))

Submission status: Wrong Answer

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

if M == 0:
    print(0,0)
    exit()

pS = [list(input().split()) for _ in range(M)]
ACed = [False] * (N+1)

if N == 1:
    if pS[0][1] == "AC":
        print(1,0)
    else:
        print(0,1)
    exit()

n_ac = 0
n_pena = 0

for i in range(M):
    if not ACed[int(pS[i][0])]:
        if pS[i][1] == "AC":
            ACed[int(pS[i][0])] = True
            n_ac += 1
        else:
            n_pena += 1

print(n_ac, n_pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
a = 0
b = 0
sp = dict()
for _ in range(M):
    s, p = input().split()
    if not s in sp.keys():
        if p == "AC":
            a +=1
        else:
            b+=1
        sp[s] = p
    else:
        if sp[s] == "AC":
            continue
        else:
            if p == "AC":
                a +=1
            else:
                b+=1
            sp[s] = p
print(a, b)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split(" ")))
dic = {}
Acount = 0
Wcount = 0
for i in range(M):
    x1,y1=[i for i in input().split()]
    if x1 in dic:
        if dic[x1] == "WA" and y1 == "AC":
            Acount += 1
            dic[x1] = y1
    else:
        if y1 == "AC":
            Acount += 1
            dic[x1] = y1
        else:
            Wcount += 1
            dic[x1] = y1
print(Acount,Wcount)

Submission status: Wrong Answer

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

p = [i[0] for i in pS]
S = [i[1] for i in pS]

aced = [False for _ in range(N)]
penalty = [0 for _ in range(N)]

for i in pS:
    if not aced[int(i[0])-1]:
        if i[1] == 'WA':
            penalty[int(i[0])-1] += 1
        if i[1] == 'AC':
            aced[int(i[0])-1] += True

print(aced.count(True), sum(penalty))

Submission status: Wrong Answer

Solution code:
n,M = map(int,input().split())
ls = []
for i in range(M):
    p,m = map(str,input().split())
    ls.append([p,m])
    
ac = 0
wa = 0
now = ""
p = 0
c = 0
for i in range(M):
    if now == ls[i][0]:
        continue
    if ls[i][0] != ls[i-1][0] and c == 0:
        wa -= p
        p = 0
    if ls[i][1] == "AC":
        now = ls[i][0]
        ac += 1
        c = 1
    elif ls[i][1] == "WA":
        wa += 1
        c = 0
        p += 1
        
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import math
n,m = map(int,input().split())
ps_ls = [list(input().split()) for i in range(m)]
ans_wa = 0
ans_ac = 0
strk_wa = 0
frag = 1
for i in range(m):
    ps_ls[i][0] = int(ps_ls[i][0])
ps_ls.sort(key=lambda x: x[0])

for i in range(m-1):
    if ps_ls[i][1] == "WA" and frag == 1:
        strk_wa += 1

    if ps_ls[i][1] == "AC":
        if frag == 1:
            ans_ac += 1
        frag = 0
        ans_wa += strk_wa
    if ps_ls[i][0] != ps_ls[i+1][0]:
        strk_wa = 0
        frag = 1
if ps_ls != []:
    if ps_ls[-1][1] == "AC":
        if frag == 1:
                ans_ac += 1
        ans_wa += strk_wa

print(ans_ac,ans_wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[]
S=[]
for i in range(M):
  p,s=map(str,input().split())
  P.append(int(p))
  S.append(s)
ac=0
wa=0
U=[0]*(N+1)
T=[0]*(N+1)
#print(P)
#print(S)

for i in range(M):
  if S[i]=="AC":
    U[P[i]]=1
  elif S[i]=="WA" and U[P[i]]!=1:
    T[P[i]] += 1
print(sum(U),sum(T))

Submission status: Wrong Answer

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

for i in range(M):
  res = input().split()
  p = int(res[0])  #問題番号
  s = res[1]  #結果

  if not p in AC:
    if s == 'AC':
      AC.append(p)
    else:
      WA.append(p)
    
print(str(len(AC)) + ' ' + str(len(WA)))

Submission status: Wrong Answer

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

ans_list = [["WA", 0] for i in range(N)]


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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[]
p=[]
s=[]
cnt=0
flag=[0 for i in range(n)]
for i in range(m):
  a=input()
  ps.append(a)
for i in range(m):
  b=ps[i][0]
  p.append(int(b))
  c=ps[i][2]+ps[i][3]
  s.append(c)
for i in range(m):
  if s[i]=="WA" and flag[p[i]-1]==0:
    cnt+=1
  if s[i]=="AC" and flag[p[i]-1]==0:
    flag[p[i]-1]=1
print(cnt)

Submission status: Wrong Answer

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

c_l = list()
a = 0
w = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if p not in c_l:
    continue

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
di = {}
pe = 0
ac = 0
for i in range(M):
    inp = input().split(" ")
    if inp[1] == "WA":
        if inp[0] in di:
            if di[inp[0]] == "WA":
                pe+=1
        else:
            di[inp[0]] = "WA"
            pe+=1
            
    else:
        di[inp[0]] = "AC"
for v in di.values():
    if v == "AC":
        ac += 1
print(str(pe)+" "+str(ac))

Submission status: Wrong Answer

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

nAC = 0
nWA = 0
result_dic = {}

for i in range(M):
    pi, si = input().split()
    
    if pi not in result_dic.keys():
        result_dic[pi] = si
        if si == "AC":
            nAC += 1
        else:
            nWA += 1
    else:
        pi_res = result_dic[pi]
        if pi_res == "AC":
            pass
        elif pi_res == "WA":
            if si == "AC":
                nAC += 1
                result_dic[pi] = si
            elif si == "WA":
                nWA += 1
                result_dic[pi] = si

print(nAC,nWA)

Submission status: Wrong Answer

Solution code:
import sys

def resolve():
    input = sys.stdin.readline
    N,M=map(int,input().rstrip().split())
    Q=[list(input().rstrip().split()) for _ in range(M)]

    c=[0 for _ in range(N)]
    flag=[0 for _ in range(N)]

    for i in range(M):
        if Q[i][1]=="WA" and flag[int(Q[i][0])-1]==0:
            c[int(Q[i][0])-1]+=1
        else:
            flag[int(Q[i][0])-1]=1
    
    ans=sum(c)
    ansAC=sum(flag)
    print(ansAC, ans)

import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 5
1 WA
1 AC
2 WA
2 AC
2 WA"""
        output = """2 2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """100000 3
7777 AC
7777 AC
7777 AC"""
        output = """1 0"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """6 0"""
        output = """0 0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    #unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:




def main():
    n,m = map(int,input().split())
    d = dict()
    for i in range(m):
        a,b = input().split()
        a = int(a)
        if a not in d:
            d[a] = [0]
        if d[a][-1] != "AC":
            d[a].append(b)
    ac = 0
    pe = 0
    #print(d)
    for i in d.values():
        #print(i)
        if i[-1] == "AC":
            ac += 1
        pe += i.count("WA")
    print(ac,pe)








if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
problem_num, sub_num = map(int, input().split())
ac = 0
wa = 0
rem = {}
for _ in range(sub_num):
    problem, result = input().split()
    # すでに問題を提出していたら
    if problem in rem.keys():
        # 1ならすでにACしている
        if rem[problem] == 1:
            continue
        # ACしてないなら
        else:
            if result == 'WA':
                wa += 1
            else:
                ac += 1
                rem[problem] = 1
    else:
        rem[problem] = 0
        if result == 'WA':
            wa += 1
        else:
            ac += 1
            rem[problem] = 1

print(ac, wa)

Submission status: Wrong Answer

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

flag = 0
wa = {}
AC_count = 0
WA_count = 0
for i in range(m):
    if ps[i][0] != flag:
        if ps[i][1] == 'AC':
            AC_count += 1
            if ps[i][0] in wa.keys():
                WA_count += wa[ps[i][0]]
            flag = ps[i][0]
        else:
            if ps[i][0] in wa.keys():
                wa[ps[i][0]] += 1
            else:
                wa[ps[i][0]] = 1
print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
a=[sys.stdin.readline().split() for i in range(m)]
wa = [0 for i in range(n)]
ac = [0 for i in range(n)]

for i in range(m):
    p = int(a[i][0])-1
    s = a[i][1]
    if s=="WA" and ac[p]==0:
        wa[p] +=1
        #print(wa, 'wa', i)
    elif s=="AC":
        ac[p] = 1
        #print(ac, 'ac', i)


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

Submission status: Wrong Answer

Solution code:
def main():
  AC = 0
  WA = 0
  
  N,M = map(int, input().split())
  
  Q = [0] * N
  
  P = [0] * M
  S = [0] * M
  
  for i in range(M):
    _p, _s = input().split()
    P[i] = int(_p)
    S[i] = _s
    
  for i,s in enumerate(S):
    if s == 'AC' and Q[P[i]-1]  == 0:
      AC += 1
      for j in range(i):
        if P[j] == P[i] and S[j] == 'WA':
          WA += 1
          Q[P[i]-1]  = 1
  
  print(AC, WA)
  return 0

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    n, m = map(int, input().split())
    wa = 0
    ac_status = defaultdict(bool)
    wa_count = defaultdict(int)
    for _ in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            if ac_status[p] == False:
                wa += wa_count[p]
                ac_status[p] = True
        else:
            if ac_status[p] == False:
                wa_count[p] += 1
    ac = len([v for v in ac_status.values() if v])
    wa = sum([v for v in wa_count.values()])
    #print(ac_status)
    #print(wa_count)
    print(ac, wa)


input = lambda: stdin.readline().rstrip()
main()

Submission status: Wrong Answer

Solution code:
import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
num_ac = num_wa = 0
acs = [0]*n
for X in inputs[1:]:
    p, s = X.split()
    p = (int(p)-1)
    if acs[p] == 0:
        if s == 'AC':
            num_ac += 1
            acs[p] = 1
        else:
            num_wa += 1
        
print(*[num_ac, num_wa])

Submission status: Wrong Answer

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

ac = dict()
wa = dict()
q_get_ac = []

for s in s_list:
  if s[0] in q_get_ac:
    break
  elif s[1] == 'AC':
    if s[0] in ac:
      ac[s[0]] += 1
    else:
      ac[s[0]] = 1
    q_get_ac.append(s[0])
  elif s[1] == 'WA':
    if s[0] in wa:
      wa[s[0]] += 1
    else:
      wa[s[0]] = 1

ac_sum = 0
wa_sum = 0
for key in ac:
  ac_sum += ac[key]
  if key in wa:
    wa_sum += wa[key]

print('{} {}'.format(ac_sum, wa_sum))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    ps = input().split()
    p.append(int(ps[0]))
    s.append(ps[1])

sum_ok = 0
sum_miss = 0
former_ok = []
for i in range(m):
    if s[i] == 'AC' and p[i] not in former_ok:        
        sum_ok += 1
        former_ok.append(p[i])
    elif s[i] == 'WA' and p[i] not in former_ok:
        sum_miss += 1
    if sum_ok == n:
        break
print(sum_ok, sum_miss)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int,input().split()))
a = []
for i in range(m):
  s,t = input().split()
  a.append((int(s), t))
wa = 0
ac = 0
i = 0
list = []
while i < m:
  if a[i][0] not in list:
    if a[i][1] == 'WA':
      wa = wa + 1
    else:
      ac = ac + 1
      list.append(int(a[i][0]))
  i = i + 1

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N,M = map(int, input().split())
a = [list(input().split()) for i in range(M)]
s=0
t=0
P=[]
for i in range(M):
    j=a[i][0]
    if j in P:continue
    else:
        if a[i][1]=="WA":
            t+=1
        else:
            s+=1
            P.append(j)
print(s,t)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[0]*M
S=[0]*M
cor=[0]*N
ac,wa=0,0
for i in range(M):
    P[i],S[i]=input().split()
    P[i]=int(P[i])
for i in reversed(range(M)):
    if(cor[P[i]-1]==1 and S[i]=="WA"):
        wa+=1
    elif(cor[P[i]-1]==0 and S[i]=="AC"):
        cor[P[i]-1]=1
        ac+=1
    else:
        pass
print("{0} {1}".format(ac,wa))

Submission status: Wrong Answer

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

N, M = map(int, input().split())
a = []

for _ in range(M):
    a.append(input().split())

p = list(map(lambda x: int(x[0]), a))
s = list(map(lambda x: 0 if x[1] == 'WA' else 1, a))
sl = []
ans = 0
pen = 0
for i in range(M):
    if p[i] in sl:
        continue

    if s[i]:
        ans += 1
        sl.append(p[i])
    else:
        pen += 1

print(ans, pen)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin as s
n,m=map(int,s.readline().split())
l=[0]*n
pen=0
for i in range(m):
  x,y=s.readline().split()
  x=int(x)-1
  if y=="AC":
    l[x]=1
  elif not l[x]:
      pen+=1
print(sum(l),pen)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split()]
problem = [i for i in range(1, N+1)]
print(problem)

correct = 0
penalty = 0

ans = set([])

for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p in ans:
        continue
    elif S == 'WA':
        penalty += 1
    elif p in problem:
        correct += 1
        ans.add(p)

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n, m = [int(x) for x in input().split(" ")]
ans = 0
pen = 0
prbstate = {}
for i in range(m):
    p, s = input().split(" ")
    prbstate.setdefault(p, 0)
    if s == "AC":
        prbstate[p] = 1
    if s == "WA" and prbstate[p] == 0:
        pen += 1
for x in prbstate.values():
    ans += x
print(ans, pen)

Submission status: Wrong Answer

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

ans = {str(i): [0, 0] for i in range(1, n + 1)}
for i in range(m):
    # p, s = p_list[i], s_list[i]
    p, s = input().split()
    if s == 'WA' and ans[p][0] == 0:
        ans[p][1] += 1
    elif s == 'WA' and ans[p][0] == 1:
        pass
    elif s == 'AC' and ans[p][0] == 0:
        ans[p][0] = 1
    else:
        pass
sum_ac = 0
sum_wa = 0
for x, y in ans.values():
    sum_ac += x
    sum_wa += y

print(sum_ac, sum_wa)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
a = []
for i in range(m):
    a.append([str(i) for i in input().split()])

ac = []
ans2 = 0
for i in range(m):
    if a[i][1] == "AC":
        ac.append(a[i][0])
    if (not (a[i][0] in ac)) and (a[i][1] == "WA"):
        ans2 += 1
ans1 = len(set(ac))

print(ans1,end = " ")
print(ans2)

Submission status: Wrong Answer

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

print(int(sum(record)), penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans = list(input().split() for i in range(M))
count = 0
hantei = []
cnt = 0
for i in range(len(ans)):
    if ans[i][1]=="AC":
        count += 1
        hantei.append((ans[i][1],ans[i][0]))

    else:
        cnt += 1
kotae = set(hantei)
kari=[ans[i][1] for i in range(len(ans))]
kari.reverse()
kouho = []
for j in range(len(kari)):
    if kari[j] == "AC":
        kouho.append(j)
if kouho == []:
    K = cnt
else:
    K=kouho[0]
print(len(kotae),cnt-K)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
wa = 0
ac = 0
ans = {'AC':0, 'WA':0}
ac_list = {'AC':[], 'WA':[]}
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s = input().split()
        if ac_list['AC'].count(p) ==0:
            ans[s] += 1
            ac_list[s].append(p)
        else:
            pass
    print(ans['AC'], ans['WA'])

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    ans = [False for _ in range(N)]

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)
        if result == "AC":
            if ans[i-1] == False:
                ac += 1
                ans[i - 1] = True
        else:
            if ans[i - 1] == False:
                wa += 1
    if sum(ans) == 0:
        wa = 0

    print(ac, wa)
    return 0
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p=[0]*M
S=[0]*M

for j in range(M):
  p[j],S[j] = input().split()
  p[j]=int(p[j])

solve=set()
pena=0

for i in range(M):
  if p[i] in solve:
    pass
  else:
    if S[i]=="WA":
      pena+=1
    else:
      solve.add(p[i])

print(len(solve),pena)

Submission status: Wrong Answer

Solution code:




def main():
    n,m = map(int,input().split())
    d = dict()
    for i in range(m):
        a,b = input().split()
        a = int(a)
        if a not in d:
            d[a] = [0]
        if d[a][-1] != "AC":
            d[a].append(b)
    ac = 0
    pe = 0
    print(d)
    for i in d.values():
        #print(i)
        if i[-1] == "AC":
            ac += 1
        pe += i.count("WA")
    print(ac,pe)








if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d=[ input().split() for i in range(m)]
ans=[[0,0] for i in range(m+n+1)]
count=0
ac=0
wa=0

for i in range(m):
  if count!=d[i][0]:
    count=int(d[i][0])
  if d[i][1]=="WA" and ans[count][0]==0:
    ans[count][1]+=1
  elif d[i][1]=="AC" and ans[count][0]==0:
    ans[count][0]+=1
for i in range(n+m+1):
  ac+=int(ans[i][0])
  wa+=int(ans[i][1])
print(ac,wa)

Submission status: Wrong Answer

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

ac_set = set()
penalty = 0
for i in range(M):
    p, s = input().split()
    if s == "AC":
        ac_set.add(p)
    else:
        penalty += 0 if (p in ac_set) else 1


print(len(ac_set), penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
li=[]
p_li=[0]*n
ac = 0
wa = 0
for _ in range(m):
    a,b = input().split()
    li.append([int(a),b])

for i in li:
    if i[1] == "AC":
        if p_li[i[0]-1] == 0:
            ac += 1
            p_li[i[0]-1] = 1
    else:
        if p_li[i[0]-1] == 0:
            wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = []
seitou = 0
penalty = 0

if m == 0:
    print(0, 0)

else:
    for x in range(m):
        i, j = map(str, input().split())
        if i in li:
            pass
        else:
            if j == "WA":
                penalty += 1
            if j == "AC":
                li.append(i)
                seitou += 1

    print(seitou, penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
AC=[]
WA=0
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
  else:
    if p not in AC:
      WA+=1
print(min(N,len(set(AC))),WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
#nは問題数　mは提出数（AC_WAの配列長）

p = [0]*m
p_tmp = "0"
s = [0]*m
check = [0]*n
for i in range(m):
  p_tmp, s[i] = (map(str, input().split()))
  p[i] = int(p_tmp)
  #pは問題No. 　sはAC or WA
  #check[i] = 0 ならwa 1なら既にac
  
for i in range(n):
  check[i] = 0
  
num_correct = 0
num_penalty = 0

for i in range(m):
  if( check[ p[i]-1 ] == 0 and s[i] == "WA"):
    num_penalty = num_penalty + 1
  elif( check[ p[i]-1 ] == 0 and s[i] == "AC"):
    num_correct = num_correct + 1
    check[p[i]-1] = 1

print(num_correct, num_penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p_L,s_L = [],[]
dic = {}
for i in range(10**5+1):
    dic[str(i)] = "0"
ac_dic = {}
wa_dic = {}
wa_L = []

counter = 0
for i in range(m):
    p,s = map(str,input().split())
#    if dic[p] != "0":
#        if dic[p]
    #p_L.append(int(p))
    #s_L.append(s)
    if s =="AC":
        ac_dic[p] = "AC"


    if dic[p] == "0":
        wa_L.append(counter)
        counter = 0
    if s == "WA":
        counter += 1
        dic[p] == "WA"

mondai = set(p_L)
#w = "WA"
#a = "AC"

print(len(ac_dic),sum(wa_L))

Submission status: Wrong Answer

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

ac_list = [0] * N
wa_list = [0] * N

for p, S in questions:
    if S == 'AC':
        ac_list[p - 1] = 1
    else:
        if ac_list[p - 1] == 1:
            continue
        wa_list[p - 1] += 1
print(sum(ac_list), sum(wa_list))

Submission status: Wrong Answer

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

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

CA = []
PN = 0

for d in data:
    if d[0] in CA:
        continue
    else:
        if d[1]=='AC':
            CA.append(d[0])
        else:
            PN += 1

print("{} {}".format(len(CA),PN))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N, M = map(int, input().split())
P = []
S = []
for i in range(M):
  p, s = input().split()
  P.append(int(p))
  S.append(s)
d = defaultdict(int)
d1 = defaultdict(int)
for i in range(M):
  if S[i] == "WA":
    if d[P[i]] != 1:
      d1[P[i]] += 1
  elif S[i] == "AC":
    d[P[i]] = 1
for i in range(len(d)+1):
  if d[i] == 0 and d1[i] > 0:
    d1[i] = 0
print(sum(d.values()), sum(d1.values()))

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
p = []
s = []
for i in range(m):
    _p, _s = list(input().split())
    p.append(_p)
    s.append(_s)


def get_ac_wa(wa_ac_list):
    wa = 0
    ac = 0
    for i, wa_ac in enumerate(wa_ac_list):
        if wa_ac == "AC":
            ac += 1
            break
        else:
            wa += 1
    return ac, wa


ac = 0
wa = 0
for _pp in set(p):
    _ss = []
    for _p, _s in zip(p, s):
        if (_p == _pp):
            _ss.append(_s)
    _ac, _wa = get_ac_wa(_ss)
    ac += _ac
    wa += _wa
print(ac, wa)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N,M = inputMap()
	ansrs_AC = [0 for i in range(N)]
	ans1 = 0
	ans2 = 0
	for i in range(M):
		inp = input()
		p, S = inp.split(" ")
		pp = int(p)
		S = S[:-1]
		if S == "AC":
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ansrs_AC[pp-1] = 1
				ans1 += 1
		else:
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ans2 += 1


	print("{} {}".format(ans1, ans2))

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
p = [0] * m
s = [0] * m
for i in range(m):
  tmp = input().split()
  p[i] = int(tmp[0])
  s[i] = tmp[1]

ok = 0
ng = 0
ok_l = []

for i in range(m):
  if s[i] == 'AC' and ok_l.count(p[i]) == 0:
    ok_l.append(p[i])
    ok += 1
  if s[i] == 'WA' and ok_l.count(p[i]) == 0:
    ng += 1

print(ok, ng)