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(' '))
results = [list(map(str ,input().split(' '))) for i in range(M)]

ac = []
pena = []
for n in range(1, N+1):
    S = [r[1] for r in results if r[0]==str(n)]
    if 'WA' not in S:
        ac.append(1)
        break
    elif 'AC' in S and 'WA' in S:
        S = S[:S.index('AC')]
        pena.append(S.count('WA'))
        ac.append(1)
    elif 'AC' not in S and 'WA' in S:
        pena.append(S.count('WA'))
        
    
print(str(sum(ac))+' '+str(sum(pena)))

Submission status: Wrong Answer

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

lac = [0]*(N+1)
pcnt = 0

for i in range(M):
  s = input().split()
  n = int(s[0])
  if s[1] == "AC":
    lac[n] =1
  if s[1] == "WA" and lac[n] == 0:
    pcnt += 1
    
print(sum(lac),end=" ")
print(pcnt)

Submission status: Wrong Answer

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

ac = []
pena = []
for n in range(1, N+1):
    S = [r[1] for r in results if r[0]==str(n)]
    if 'WA' not in S:
        ac.append(1)
        break
    elif 'AC' in S and 'WA' in S:
        S = S[:S.index('AC')]
        pena.append(S.count('WA'))
        ac.append(1)
    
print(str(sum(ac))+' '+str(sum(pena)))

Submission status: Wrong Answer

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

ac = []
pena = []
for m in range(1, M+1):
    S = [r[1] for r in results if r[0]==str(m)]
    if 'AC' in S:
        S = S[:S.index('AC')]
        pena.append(S.count('WA'))
        ac.append(1)
print(str(sum(ac))+' '+str(sum(pena)))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, M = map(int, input().split(" "))
count = [0 for i in range(N)]
flag = [0 for i in range(N)]
correct = 0
for i in range(M):
    tmp = input().split(" ")
    p, S = int(tmp[0]), tmp[1]
    if S == "WA" and flag[p-1] == 0:
        count[p-1] += 1
    elif S == "AC" and flag[p-1] == 0:
        correct += 1
        flag[p-1] = 1
print(sum(count), sum(count))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, M = map(int, input().split(" "))
count = [0 for i in range(N)]
flag = [0 for i in range(N)]
correct = 0
for i in range(M):
    tmp = input().split(" ")
    p, S = int(tmp[0]), tmp[1]
    if S == "WA" and flag[p-1] == 0:
        if flag[p-1] == 0:
            count[p-1] += 1
    elif S == "AC" and flag[p-1] == 0:
        correct += 1
        flag[p-1] = 1
print(correct, sum(count))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, M = map(int, input().split(" "))
count = [0 for i in range(N)]
flag = [0 for i in range(N)]
correct = 0
for i in range(M):
    tmp = input().split(" ")
    p, S = int(tmp[0]), tmp[1]
    if S == "WA":
        if flag[p-1] == 0:
            count[p-1] += 1
    elif S == "AC" and flag[p-1] == 0:
        correct += 1
        flag[p-1] = 1
print(correct, sum(count))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p, S = [0]*M, [0]*M
for i in range(0,M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])
s, t = 0, 0
res = []
for i in range(0,N):
    res.append([i,0])
for i in range(0,M):
    if S[i] == "WA":
        res[p[i]-1][1] = res[p[i]-1][1]+1
    elif res[p[i]-1][1] >= 0:
        s, t = s+1, t+res[p[i]-1][1]
        res[p[i]-1][1] = -1
print(s, t)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0

for i in range(1,m+1):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if flag == 1:
        continue
    if s[i] == 'AC':
        flag = 1
        a_count += 1
    else:
        w_count += 1
    
print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0
flag = 0
for i in range(1,m+1):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if flag == 1:
        continue
    if s[i] == 'AC':
        flag = 1
        a_count += 1
    elif s[i] == 'WA':
        w_count += 1
    
print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0
flag = 0
for i in range(1,m+1):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if flag == 1:
        continue
    if s[i] == 'AC' and flag == 0:
        flag = 1
        a_count += 1
    elif s[i] == 'WA':
        w_count += 1
    

    


print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0
flag = 0
for i in range(1,m+1):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if s[i] == 'AC' and flag == 0:
        flag = 1
        a_count += 1
    elif s[i] == 'WA':
        w_count += 1 and flag == 0
    


print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0
flag = 0
for i in range(1,m):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if s[i] == 'AC' and flag == 0:
        flag = 1
        a_count += 1
    elif s[i] == 'WA':
        w_count += 1 and flag == 0
    


print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
import copy

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

for x in range(M):
    L[x][0]=int(L[x][0])

#print(N,M)
#print(L)

S=[]
component=[0,0]
for j in range(N):
    S.append(copy.deepcopy(component))

#print(S)

for k in range(1,M+1):
    if L[k-1][1]=='AC':
        if S[L[k-1][0]-1][0]==0:
            S[L[k-1][0]-1][0]=1
    else:
        if S[L[k-1][0]-1][0]==0:
            S[L[k-1][0]-1][1]+=1
    #print(S)

ansAC=0
ansWA=0

for l in range(N):
    ansAC+=S[l][0]
    ansWA+=S[l][1]

print(ansAC,ansWA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0
flag = 0
for i in range(1,m+1):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if s[i] == 'AC' and flag == 0:
        flag = 1
        a_count += 1
    if s[i] == 'WA':
        w_count += 1 and flag == 0
    


print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
import copy

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

L=[list() for i in range(N)]

for j in range(M):
    p,s=map(str,input().split())
    p=int(p)
    L[p-1].append(copy.deepcopy(s))

right=0
wrong=0

for k in range(N):
    for l in range(len(L[k])):
        if L[k][l]=='WA':
            wrong+=1
        else:
            right+=1
            break

print(right,wrong)

Submission status: Wrong Answer

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('01-handmade-05.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    N, M = read_int_list()
    p = [0] * M
    S = [''] * M
    for i in range(M):
      l = read_str_list()
      p[i] = int(l[0])
      S[i] = l[1]
      
    correct, penalties = 0, 0
    f = set()  
    r = set()    
    for i in range(M):
      if S[i] == 'AC':
        if p[i] not in r:
          r.add(p[i])

      if S[i] == 'AC':
        if p[i] not in f:
          f.add(p[i])
          correct += 1
      if S[i] == 'WA':
        if p[i] not in f and p[i] in r:
          penalties += 1

    print(correct, penalties)

main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0
flag = []
for i in range(1,m+1):
    p[i],s[i] = input().split()
    if s[i] == 'AC' and p[i] not in flag:
        flag.append(p[i])
        a_count += 1
    if s[i] == 'WA' and p[i] not in flag:
        w_count += 1

print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    N, M = read_int_list()
    f = set()          
    correct, penalties = 0, 0
    for i in range(M):
      l = read_str_list()
      p = int(l[0])
      S = l[1]
      
      if S == 'AC':
        if p not in f:
          f.add(p)
          correct += 1
      if S == 'WA':
        if p not in f:
          penalties += 1

    print(correct, penalties)

main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [0] * (m + 2)
s = [0] * (m + 2)
w_count = 0
a_count = 0
flag = []
for i in range(1,m+1):
    p[i],s[i] = input().split()

for i in range(m):
    if s[i] == 'AC' and p[i] not in flag:
        flag.append(p[i])
        a_count += 1
    if s[i-1] == 'AC' and s[i] == 'WA' and p[i] == p[i-1]:
        continue

    if s[i] == 'WA':
        w_count += 1
print(a_count,w_count)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
results = [input().split() for _ in range(M)]
solved = set()
penalty = 0

for p, S in results:
    if p in solved:
        continue

    if S == 'AC':
        solved.add(p)
    else:
        penalty += 1

print(len(solved), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
solved = set()
penalty = 0

for _ in range(M):
    p, S = input().split()
    if p in solved:
        continue

    if S == 'AC':
        solved.add(p)
    else:
        penalty += 1

print(len(solved), penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
submits = []
for i in range(m):
  submit = input().split()
  submits.append(submit)
wa = 0
ac = 0
if m != 0:
  l = [submits[0]]
for i in range(1, m):
  if submits[i] == submits[i-1]:
    l.append(submits[i])
  else:
    l = []
    l.append(submits[i])
  if i != m-1 and submits[i] != submits[i+1]:
    for j in range(len(l)):
      if l[j][1] == "WA":
        wa += 1
      else:
        ac += 1
        break
  elif i == m-1:
    for j in range(len(l)):
      if l[j][1] == "WA":
        wa += 1
      else:
        ac += 1
        break
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
q = []
r = []
for _ in range(m):
    sub = input().split()
    q.append(int(sub[0]))
    r.append(sub[1])

subs = {"q": q, "r": r}
ac = set()
penalty = 0

for i in range(m):
    if subs["r"][i] == "AC":
        if not subs["q"][i] in ac:
            ac.add(subs["q"][i])
    else:
        if not subs["q"][i] in ac:
            penalty += 1
print(len(ac), penalty)

Submission status: Wrong Answer

Solution code:
from sys import stdin

def main():
    n,m = map(int,stdin.readline().split())
    arr= [0 for _ in range(n+1)]
    p=0;a= 0
    for _ in range(m):
        x,y = stdin.readline().split()
        x = int(x)
        if  arr[x] != -1:
            if y == "WA":
                p+=1
            else:
                a+=1
                arr[x] = -1
    print(a,p)
main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
L = [0]*n
ans = 0
penalty = 0
for i in range(m):
  p,q = input().split()
  if q == 'AC':
    if L[int(p)-1] == 0:
      L[int(p)-1] = 1
    ans += 1
  else:
    if L[int(p)-1] == 0:
      penalty += 1
print(ans,penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
L = [0]*n
ans = 0
penalty = 0
for i in range(m):
  p,q = input().split()
  if q == 'AC':
    if L[int(p)-1] == 0:
      L[int(p)-1] = 1
      ans += 1
  else:
    if L[int(p)-1] == 0:
      penalty += 1
print(ans,penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
P = []
S = []
for i in range(m):
    p, s = input().split()
    P.append(p)
    S.append(s)
V = [0] * n
a = 0
w = 0
for i in range(m):
    j = int(P[i]) - 1
    if V[j] != 1:
        if S[i] == 'AC':
            V[j] = 1
            a += 1
        else:
            w += 1
print(a, w)

Submission status: Wrong Answer

Solution code:
N,M = [int(i) for i in input().rstrip().split(' ')]
P = [0 for _ in range(N)]
ans,pen = 0,0
for _ in range(M):
    p,s = input().rstrip().split(' ')
    p = int(p) - 1
    if P[p] == -1:
        continue
    if s == "WA":
        P[p] += 1
        pen += 1
    else:
        ans += 1
        P[p] = -1
print(ans,pen)

Submission status: Wrong Answer

Solution code:
import numpy as np

if __name__ == "__main__":
  _n, _m = map(int, input().split())
  flag = set()
  ans_wa = 0
  ans_ac = 0
  for i in range(_m):
    _p, _s = input().split()
    _p = int(_p)
    if _s == 'AC':
      flag.add(_p)
    else:
      assert _s == 'WA'
      if _p not in flag:
        ans_wa += 1

  print(int(len(flag)), int(ans_wa))

Submission status: Wrong Answer

Solution code:
import numpy as np

if __name__ == "__main__":
  _n, _m = map(int, input().split())
  flag = set()
  ans_wa = 0
  ans_ac = 0
  for i in range(_m):
    _p, _s = input().split()
    _p = int(_p)
    if _s == 'AC':
      if _p not in flag:
        ans_ac += 1
      flag.add(_p)
    else:
      if _p not in flag:
        ans_wa += 1

  print(int(ans_ac), int(ans_wa))

Submission status: Wrong Answer

Solution code:
import numpy as np

if __name__ == "__main__":
  _n, _m = map(int, input().split())
  flag = set()
  ans_wa = 0
  ans_ac = 0
  for i in range(_m):
    _p, _s = input().split()
    _p = int(_p)
    if _s == 'AC':
      if _p not in flag:
        ans_ac += 1
        flag.add(_p)
    else:
      if _p not in flag:
        ans_wa += 1

  print(int(ans_ac), int(ans_wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]
for _ in range(m):
  a,b = input().split()
  a = int(a) - 1
  if b == 'AC':
    ac[a] = 1
  elif ac[a] == 0:
    wa[a] += 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n, m = map(int, input().strip().split())
  counts = numpy.zeros(n).astype(numpy.int)
  flags = numpy.zeros(n).astype(numpy.int)
  for _ in range(m):
    p, s = input().strip().split()
    p = int(p)
    if s == 'WA' and flags[p-1] != 1:
      counts[p-1] += 1
    if s == 'AC':
      flags[p-1] = 1
  print(numpy.sum(flags), numpy.sum(counts))

if __name__=='__main__':
  main()

Submission status: Wrong Answer

Solution code:
[N, M] = map(int, input().rstrip().split(' '))
ps = []
ss = []

result = {}
ac = 0
wa = 0

for i in range(M):
    [p, s] = input().rstrip().split(' ')
    # 初めての結果
    if result.get(p) == None:
        result[p] = s
        if s == "WA":
            wa += 1
        elif s == "AC":
            ac += 1
    # すでにAC済み
    elif result[p] == "AC":
        continue
    #  すでにWA済み
    else:
        # 今回正解
        if s == "AC":
            result[p] = s
            ac += 1
        # 今回不正解
        else:
            wa += 1

print(" ".join(map(str, [ac, wa])))

Submission status: Wrong Answer

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

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

for i in range(m):
    if p[i][1] == "AC":
        ac[p[i][0]-1] = 1
    if p[i][1] == "WA":
        if ac[p[i][0]-1] != 0:
            continue
        else:
            wa[p[i][0]-1] += 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
mondai = [0 for i in range(N)]
c = []
ans = 0
for i in range(M):
    p,s = input().split()
    if s == "WA":
        mondai[int(p)-1] += 1
    elif s == "AC":
        c.append(p + s)
        ans += mondai[int(p)-1]       
print(len(set(c)),ans)

Submission status: Wrong Answer

Solution code:
[N, M] = map(int, input().rstrip().split(' '))
ps = []
ss = []

result = {}
ac = 0
wa = 0

for i in range(M):
    [p, s] = input().rstrip().split(' ')
    if result.get(p) == None:
        result[p] = s
        if s == "WA":
            wa += 1
        elif s == "AC":
            ac += 1
    else:
        if result[p] == "WA":
            if s == "AC":
                result[p] = s
                ac += 1
            else:
                wa += 1

print(" ".join(map(str, [ac, wa])))

Submission status: Wrong Answer

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

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

ac = 0
wa = 0
time = 0
cor = []

for time in range(M):
    if p[time] in cor:
        continue
    if S[time] == "AC":
        ac += 1
        cor.append(p[time])
    else:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

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

time = 0
CorrectQuestion = []
CorrectNum  = []
InCorrectNum = []

for hunya in range(M):

    if S[time] == "WA": #S = AnswerNum
        if p[time] in CorrectQuestion: #p = QuestionNum
            time += 1
        else:
            InCorrectNum.append(1)
            time += 1

    else:
        if p[time] in CorrectQuestion:
            time += 1
        else:
            CorrectNum.append(1)
            CorrectQuestion.append(p[time])
            time += 1

    if sum(CorrectNum) == N:
        break

print(str(sum(CorrectNum))+" "+str(sum(InCorrectNum)))

Submission status: Wrong Answer

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

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

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

time = 0
QuestionNum = list(p)
AnswerNum = list(S)
CorrectQuestion = []
CorrectNum  = []
InCorrectNum = []

for hunya in range(M):
    if AnswerNum[time] == "WA":
        if QuestionNum[time] in CorrectQuestion:
            time += 1
        elif QuestionNum[time] not in CorrectQuestion:
            InCorrectNum.append(1)
            time += 1
    elif AnswerNum[time] == "AC":
        if QuestionNum[time] in CorrectQuestion:
            time += 1
        elif QuestionNum[time] not in CorrectQuestion:
            CorrectNum.append(1)
            CorrectQuestion.append(QuestionNum[time])
            time += 1
    if sum(CorrectNum) == N:
        break

print(str(sum(CorrectNum))+" "+str(sum(InCorrectNum)))

Submission status: Wrong Answer

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

ac = 0
wa = 0

l = [0] * (N + 1)

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

Submission status: Wrong Answer

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

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

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

time = 0
QuestionNum = list(p)
AnswerNum = list(S)
CorrectQuestion = []
CorrectNum  = []
InCorrectNum = []

for hunya in range(M):
    if AnswerNum[time] == "WA":
        if QuestionNum[time] in CorrectQuestion:
            time += 1
        elif QuestionNum[time] not in CorrectQuestion:
            InCorrectNum.append(1)
            time += 1
    elif AnswerNum[time] == "AC":
        if QuestionNum[time] in CorrectQuestion:
            time += 1
        elif QuestionNum[time] not in CorrectQuestion:
            CorrectNum.append(1)
            CorrectQuestion.append(QuestionNum[time])
            time += 1

print(str(sum(CorrectNum))+" "+str(sum(InCorrectNum)))

Submission status: Wrong Answer

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

ac = 0
wa = 0

l = [0] * (N + 1)

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

Submission status: Wrong Answer

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

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

for i in range(m):
    if p[i][1] == "AC":
        ac[p[i][0]-1] = 1
    if p[i][1] == "WA":
        if ac[p[i][0]-1] != 0:
            continue
        else:
            wa[p[i][0]-1] += 1

print(str(sum(ac))+" "+str(sum(wa)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
acc = [False] * N
pen = 0
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if S[0] == 'A':
        acc[p] = True
    else:
        if not acc[p]:
            pen += 1
print('{} {}'.format(sum(acc), pen))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
acc = [False] * N
pen = 0
for _ in range(M):
  p, S = input().split()
  p = int(p) - 1
  if S[0] == 'A':
    acc[p] = True
  elif not acc[p]:
    pen += 1
print('{} {}'.format(sum(acc), pen))

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
    # N, M = map(int, input().split())
    # PS = {}
    # for i in range(M):
    #     row = input().split()
    #     row[0] = int(row[0])
    #     if row[0] not in PS:
    #         PS[row[0]] = [row[1]]
    #     else:
    #         PS[row[0]].append(row[1])

    # n_correct = 0
    # n_penalty = 0
    # for p in PS:
    #     if 'AC' in PS[p]:
    #         n_correct += 1
    #         for result in PS[p]:
    #             if result == 'AC':
    #                 break
    #             if result == 'WA':
    #                 n_penalty += 1
    
    # print('{} {}'.format(n_correct, n_penalty))

    N, M = map(int, input().split())
    accepted = [False] * N
    penalties = [0] * N
    for _ in range(M):
        q, res = input().split()
        q = int(q) - 1
        if res[0] == 'A':
            accepted[q] = True
        else:
            penalties[q] += 1

    s_acc = 0
    s_pen = 0
    for i in range(N):
        if accepted[i]:
            s_acc += 1
            s_pen += penalties[i]

    print('{} {}'.format(s_acc, s_pen))
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

p = []
s = []
ans_a = np.zeros(n+1)
ans_p = np.zeros(n+1)

for i in range(m):
    pi ,si = map(str,input().split())
    p.append(int(pi))
    s.append(si)

for i in range(m):
    if s[i] == "AC":
        ans_a[p[i]] = 1
    if s[i] == "WA" and ans_a[p[i]] == 0:
        ans_p[p[i]] += 1

print(int(np.sum(ans_a)), int(np.sum(ans_p)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
F = [0 for _ in range(N)]
w = 0
for i in range(M):
  p,s = map(str,input().split())
  if F[int(p)-1] == 0:
    if s == 'WA':
      w += 1
    elif s == 'AC':
      F[int(p)-1] = 1
      
print(sum(F),w)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
D = [[]for i in range(N)]
AC = 0
WA = 0
for i in range(M):
  plobNum,res = input().split()
  D[int(plobNum)-1].append(res)

for prob in D:
  for submit in prob:
    if submit == "WA" :
      WA+=1
    elif submit == "AC":
      AC+=1
      break
  
print("{} {}".format(AC,WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
D = [[]for i in range(N)]
AC = 0
WA = 0
for i in range(M):
  plobNum,res = input().split()
  D[int(plobNum)-1].append(res)

for prob in D:
  for submit in prob:
    if submit == "WA" :
      WA+=1
    else:
      AC+=1
      break
print("{} {}".format(AC,WA))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d=dict()
c=0
p=0
for _ in range(m):
    a,b=map(str,input().split())
    if a not in d:
        if b=="WA":
            d[a]=["WA",1]
        else:
            c+=1
            d[a]=["AC",1]
    else:
        if b=="WA":
            if d[a][0]=="AC":
                continue
            else:
                d[a][1]+=1
        else:
            print(d[a][0])
            if d[a][0]=="AC":
                continue
            c+=1
            #print(d[a][1])
            d[a][0]="AC"
            p+=d[a][1]
#print(d)
print(c,p)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d=dict()
c=0
p=0
for _ in range(m):
    a,b=map(str,input().split())
    if a not in d:
        if b=="WA":
            d[a]=["WA",1]
        else:
            c+=1
            d[a]=["AC",1]
    else:
        if b=="WA":
            if d[a][0]=="AC":
                continue
            else:
                d[a][1]+=1
        else:
            if d[a][0]=="AC":
                continue
            c+=1
            #print(d[a][1])
            p+=d[a][1]
#print(d)
print(c,p)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d=dict()
c=0
p=0
for _ in range(m):
    a,b=map(str,input().split())
    if a not in d:
        d[a]=b
        if b=="WA":
            p+=1
        else:
            c+=1
    else:
        if d[a]=="AC":
            continue
        if b=="AC":
            d[a]=b
            c+=1
        else:
            p+=1
#print(d)
print(c,p)

Submission status: Wrong Answer

Solution code:
N,M = [int(x) for x in input().split()]
ac = [0]*(N+1)
wa = [0]*(N+1)
for i in range(M):
  p,s = input().split()
  if s =="AC" and ac[int(p)]==0:
    ac[int(p)]=1
  if s=="WA" and ac[int(p)]==0:
    wa[int(p)]+=1
ans = 0
answa = 0
for i in range(N):
  if ac[i]==1:
    ans+=1
    answa+=wa[i] 
print(ans,answa)

Submission status: Wrong Answer

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

state = {}
pena = 0
correct = 0
for i in range(0, M):
    p, S = input().split()

    if p in state and state[p] == "AC":
        continue

    if S == "AC":
        correct = correct + 1
        state[p] = S
    else:
        pena = pena + 1

print("{0} {1}".format(correct, pena))

Submission status: Wrong Answer

Solution code:
N,M = [int(x) for x in input().split()]
ac = [0]*(N+1)
wa = [0]*(N+1)
for i in range(M):
  p,s = input().split()
  if s =="AC" and ac[int(p)]==0:
    ac[int(p)]=1
  if s=="WA" and ac[int(p)]==0:
    wa[int(p)]+=1

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

Submission status: Wrong Answer

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

ac = 0
wa = 0
contest = 1
_ac = 0
_wa = 0

for p in pl:
    if int(p[0]) == contest:
        if p[1] == 'AC':
            _ac += 1
        if p[1] == 'WA' and _ac == 0:
            _wa += 1
    if int(p[0]) != contest:
        contest = int(p[0])
        if _ac > 0:
            ac += 1
            wa += _wa
        _ac = 0
        _wa = 0
        if p[1] == 'AC':
            _ac += 1
        if p[1] == 'WA' and _ac == 0:
            _wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0
contest = 1
_ac = 0
_wa = 0

for p in pl:
    if int(p[0]) == contest:
        if p[1] == 'AC':
            _ac += 1
        if p[1] == 'WA' and _ac == 0:
            _wa += 1
    if int(p[0]) != contest:
        contest = int(p[0])
        if _ac > 0:
            ac += 1
            wa += _wa
        _ac = 0
        _wa = 0
        if p[1] == 'AC':
            _ac += 1
        if p[1] == 'WA' and _ac == 0:
            _wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0

challengable = [True] * n

for _ in range(m):
    num, res = input().split()
    num = int(num)

    if not challengable[num-1]:
        continue

    if res == "AC":
        ac += 1
        challengable[num-1]=False
    else:
        wa+=1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
pen=[0]*n#ペナ数
rig=[0]*n#ACorWA

for i in range(m):
    if ps[i][1]=="AC":
        rig[int(ps[i][0])-1]=1
    else:
        if rig[int(ps[i][0])-1]==0:
            pen[int(ps[i][0])-1]+=1
cnt1,cnt2=0,0
for i in range(n):
    cnt1+=rig[i]
    cnt2+=pen[i]
#print(pen)
print(str(cnt1)+" "+str(cnt2))

Submission status: Wrong Answer

Solution code:
N,M = [int(i) for i in input().split()]
AC_list = []
WA_list = []
for j in range(M):
  temp = input().split()
  if temp[1] == "AC" and temp[0] not in AC_list:
    AC_list.append(temp[0])
  elif temp[1] == "WA" and temp[0] not in AC_list:
    WA_list.append(temp[0])
    
print(len(AC_list), len(WA_list))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
dp = [0]*(N+1)
li = []
kaku = [0]*(N+1)
count =0
for m in range(M):
    p,s = input().split()
    p = int(p)
    li.append([p,s])
    
for i in li:
    if i[1]=="WA":
        dp[i[0]] += 1
    
    else:
        kaku[i[0]] = dp[i[0]]

for k in kaku:
    if k != 0:
        count += 1

print(count,sum(kaku))

Submission status: Wrong Answer

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

wa_score = [0]*N
ac_flg = [0]*N

for p,s in p_s:
    p = int(p)
    if s == 'AC':
        ac_flg[p-1] = 1
    else:
        if ac_flg[p-1] == 0:
            wa_score[p-1] += 1

print(sum(ac_flg),sum(wa_score))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N,M = map(int, input().split())

# 2次元配列
ans_list = []
for i in range(M):
    a = list(map(str, input().split()))
    ans_list.extend([a])
#print(grid)
#正答数とペナルティ数

ac_list=[]
ac_cnt=0
pnl_cnt=0
for i in range(M):
	if ans_list[i][0] not in ac_list and ans_list[i][1]=='AC':
		ac_cnt+=1
		ac_list.append(ans_list[i][0])
	elif ans_list[i][0] not in ac_list and ans_list[i][1]=='WA':
		pnl_cnt+=1
	else:
		pass

print('{} {}'.format(ac_cnt,pnl_cnt))