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

dp = [False for _ in range(n+1)]

def ans(dp, n, m) -> list:
    if m == 0:
        return [0, 0]

    ac = 0
    wa = 0
    i = 0
    while i < m:
        n, r = input().split()
        n = int(n)

        if dp[n] == False and r == 'WA':
            wa += 1

        if dp[n] == False and r == 'AC':
            ac += 1
            dp[n] = True

        i += 1

    return [ac, wa]

a = ans(dp, n, m)

print(*a)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

submit = defaultdict(list)
for i in range(M):
    p,s = map(str, input().split())
    submit[p].append(s)


wa = 0
ac = 0
for k in submit.keys():
    for i in range(len(submit[k])):
        if submit[k][i] == "WA":
            wa += 1
        elif submit[k][i] == "AC":
            ac += 1
            break


print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dic={}
w=ac=0
for _ in range(m):
  a,b=input().split()
  if a in dic:
    if dic[a]:
      if b == 'WA':
        w+=1
      else:
        ac+=1
        dic[a]=False
  else:
    dic[a]=True
    if b == 'WA':
      w+=1
    else:
      ac+=1
      dic[a]=False

print(ac,w)

Submission status: Wrong Answer

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

for i in range(m):
  c,r=input().split()
  if c in ig:
    continue
  
  if r == 'WA':
    wa+=1
  elif r == 'AC':
    ac+=1
    ig.append(c)
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[input().split() for _ in range(m)]
arr=[False for _ in range(n)]
ac,wa=0,0

for r in l:
  p,s=int(r[0])-1,r[1]
  if s=='AC' and arr[p]==False:
    ac+=1
    arr[p]=True
    continue
  elif s=='WA' and arr[p]==False and [p,'AC'] in l:
    wa+=1
    continue
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,m=mis()
    lis=[0]*(n+1)
    wa=0
    for _ in range(m):
        P,s=input().split()
        p=int(P)
        if lis[p]==0:
            if s=='WA': wa+=1
            else: lis[p]+=1
    print(sum(lis))
    print(wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, m = list(map(int,input().split()))
a = [0]*1000000
ac = 0
pen = 0
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == "AC":
        if a[p] == "AC":
            pass
        else:
            ac += 1
            pen += a[p]
            a[p] = "AC"
    else:
        if a[p] == "AC":
            pass
        else:
            a[p] += a[p] + 1
print(ac,pen)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m == 0:
  print(0,0)
  exit()
A=[[0,0] for _ in range(n)]
for i in range(m):
  p,s=input().split()
  p=int(p)-1
  if A[p][0]==1:
    continue
  elif s=='AC':
    A[p][0]=1
  else:
  	A[p][1]+=1
ac=0
wa=0
for a in A:
  ac+=a[0]
  wa+=a[1] if a[0]==1 else 0
print(A)
print(ac,wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

p = 0
ans = 0
ok = set()
t = 0
for num, r in scores:
    if r == 'AC' and num not in ok:
        ans += 1
        ok.add(num)
        p += t
        t = 0
    elif r == 'WA' and num not in ok:
        t += 1
print(ans, p)

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    N, M = MAP()

    ac = defaultdict(int)
    wa = defaultdict(int)

    for i in range(M):
        p, S = S_MAP()
        p = int(p)

        if S == "AC": ac[p] = 1
        elif ac[p] == 1: wa[p] += 1

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

li = [False] * n
wa = 0

for p,s in ps:
    if s == 'AC':
        li[int(p)-1] = True
    else:
        if not li[int(p)-1]:
            wa += 1

ac = li.count(True)

print(ac, wa)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n, m = map(int, input().split())
ac = Counter()
wa = Counter()
for _ in range(m):
    p, s = input().split()
    if s == 'WA':
        if ac[p] == 0:
            wa[p] += 1
    else:
        ac[p] = 1

for k in ac:
    if ac[k] == 0:
        wa[k] = 0


acs = sum(ac.values())
was = sum(wa.values())

print(acs, was)

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

check = 0
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 check == 1:
        sum_miss += 1
        check = 1
    elif (s[i] != 'AC' and check == 0) or (s[i] == 'WA' and check == 0):
        check = 1
    else:
        continue
print(sum_ok, sum_miss)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = [list(map(str, input().split())) for i in range(m)]
wa_i = ac_i = 0
for i in range(1, n+1):
  for j,k in li:
    if i == int(j) and k == 'WA':
      wa_i += 1
    elif i == int(j) and k == 'AC':
      ac_i += 1
      break
    else:
      continue

print(ac_i, wa_i)

Submission status: Wrong Answer

Solution code:
#N=int(input())
#N,M=map(int, input().split())
#L=list(map(int, input().split()))
N,M=map(int, input().split())
ifacL=[0]*N
psL=[]
AC=0
WA=0
for _ in range(M):
  psL.append(list(map(str, input().split())))

for i in range(M):
  if ifacL[int(psL[i][0])-1]==0 and psL[i][1]=="WA":
    WA+=1
  elif ifacL[int(psL[i][0])-1]==0 and psL[i][1]=="AC":
    AC+=1
    ifacL[int(psL[i][0])-1]=1

print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
TF=[0]*n
p=[0]*n
for _ in range(m):
    i,s =map(str,input().split())
    i=int(i)-1
    if (s=="WA") and TF[i]==0:
        p[i]+=1
    elif (s=="WA")and TF[i]==1:
        pass
    elif s=="AC" and TF[i]==0:
        TF[i]=1
    else:
        pass
ac=sum(TF)
pe=sum(p)
print(ac,pe)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().strip().split())
PS = [input().strip().split() for _ in range(M)]
acset = set()
acc = 0
wac = 0
for p, s in PS:
    if s == "WA" and p not in acset:
        wac += 1
    if s == "AC" and p not in acset:
        acc += 1
        acset.add(p)
print(acc, wac)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
corrent_flgs = [False for _ in range(N)]
correct_num = 0
wrong_num = 0

for _ in range(M):
    num_result = input().split()
    if(num_result[1] == "AC"):
        if(not corrent_flgs[int(num_result[0])-1]):
            corrent_flgs[int(num_result[0])-1] = True
            correct_num += 1
    else:
        if(not corrent_flgs[int(num_result[0])-1]):
            wrong_num += 1

print("{} {}".format(correct_num,wrong_num))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ai=[]
si=[]
for _ in range (m):
  a,s = input().split()
  ai.append(int(a))
  si.append(s)
lp=[]
lc=[]
pen=0
corr=0
for i in range (len(ai)):
  if si[i]=='AC':
    if ai[i] not in lc:
      corr+=1
      lc.append(ai[i])
  else:
    if ai[i] not in lp:
      pen+=1
      lp.append(ai[i])
print(corr,pen)

Submission status: Wrong Answer

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

if M > 0:
    wa = [0] * N
    ans = [0, 0]
    for s in S:
        if s[1] == "AC" and wa[int(s[0])-1] >= 0:
            ans[1] += wa[int(s[0])-1]
            ans[0] += 1
            wa[int(s[0])-1] = -1
        elif s[1] == "WA":
            wa[int(s[0])-1] += 1
    print(*ans)
else:
    print(0, 0)

Submission status: Wrong Answer

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

T = [0] * (N + 1)
ans = [0,0]


for i in range(M):
  p,s = input().split()
  p = int(p)
  if T[p] == 0:
    T[p] = s
    if s == "AC":
      ans[0] += 1
      T[p] = "AC"
    elif s == "WA":
      ans[1] += 1
      T[p] = "WA"
      
  elif T[p] == "AC":
    continue

  elif T[p] == "WA":
    if s == "AC":
      T[p] == s
      ans[0] += 1
    elif s == "WA":
      ans[1] += 1
      continue
      
print(ans[0],ans[1])

Submission status: Wrong Answer

Solution code:
from sys import stdin
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return list(mi())
def lsi():
	x=list(stdin.readline())
	x.pop()
	return x
def si(): return stdin.readline()
def sieve(x):
	a=[True]*(x+1)
	sq=floor(sqrt(x))
	for i in range(3, sq+1, 2):
		if a[i]:
			for j in range(i*i, x+1, i):
				a[j]=False
	if x>1:
		p=[2]
	else:
		p=[]
	for i in range(3, x+1, 2):
		if a[i]:
			p.append(i)
	return p
#vowel={'a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y'}
#pow=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808]
############# CODE STARTS HERE #############
n, m=mi()
a=[0]*(n+1)
p=s=0
for _ in range(m):
    x, y=si().split()
    x=int(x)
    if not a[x]:
        if y[0]=='A':
            s+=1
            a[x]=1
        else:
            p+=1
print(s, p)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = [0]*n
num_wa = 0
for i in range(m):
    a, b= map(str, input().split())
    if 0 == p[int(a)-1] and b == "WA":
        num_wa += 1
    elif 0 == p[int(a)-1] and b == "AC":
        p[int(a)-1] = 1

print(sum(p), num_wa)

Submission status: Wrong Answer

Solution code:
import sys
scan = sys.stdin.readline
n, m = map(int, scan().split(' '))
ans = [0] * n
wa = 0
ac = 0
for i in range(m):
    q, r = map(str, scan().strip('\n').split(' '))
    if r == 'AC':
        if ans[int(q) - 1] == 0:
            ans[int(q) - 1] = 1
            ac += 1
        else:
            break
    else:
        if ans[int(q) - 1] == 0:
            wa += 1
        else:
            break
print(ac, wa, sep=' ')

Submission status: Wrong Answer

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

corrects = [0] * n
wrongs = [0] * n

for i in range(m):
  p, cw = input().split()
  num = int(p) - 1
  if cw == "AC" and corrects[num] == 0:
    corrects[num] += 1
  if cw == "WA" and corrects[num] == 0:
    wrongs[num] += 1

print(sum(corrects))
print(sum(wrongs))

Submission status: Wrong Answer

Solution code:
import math
import fractions

n, m = map(int, input().split())
ac_list = [0 for _ in range(n)]
wa_list = [0 for _ in range(n)]
wa_cnt = 0
cnt = 1
while cnt <= m:
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac_list[p - 1] = 1
    else:
        if ac_list[p - 1] == 0:
            wa_list[p - 1] += 1
    cnt += 1
for i in range(n):
    if wa_list[i] == 1 and ac_list[i] == 1:
        wa_cnt += wa_list[i]
print(sum(ac_list), wa_cnt)

Submission status: Wrong Answer

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

if(m != 0):
    for i in range(m):
        tp = list(map(str, input().split()))
        tp[0] = int(tp[0])
        an.append(tp)

    print(an)

    sc = 0
    er = 0

    flag = 0
    prob = an[0][0]
    for i in range(m):
        pr = an[i][0]
        ans = an[i][1]
        if (prob != pr):
            flag = 0
            prob = pr
        if(flag == 0 and ans == "AC"):
            sc += 1
            flag = 1
        elif (flag == 0 and ans == "WA"):
            er += 1

else:
    sc = 0
    er = 0

print("{} {}".format(sc, er))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
a = [list(input().split()) for i in range(m)]
b=[[0,0] for i in range(n)]
AC=0
WA=0

for i in range(m):
    if b[int(a[i][0])-1][0]==0 and a[i][1]=='AC':
        b[int(a[i][0]) - 1][0]+=1
    elif b[int(a[i][0])-1][0]==1 and a[i][1]=='AC':
        continue
    elif b[int(a[i][0])-1][0]==0 and a[i][1]=='WA':
        b[int(a[i][0]) - 1][1] +=1
    elif b[int(a[i][0])-1][0]==1 and a[i][1]=='WA':
        continue

for i in range(n):
    if b[i][0]>=1:
        AC+=1
    if b[i][1]>=1:
        WA+=b[i][1]
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
S = ['WA'] * N
r,w = 0,0
for i in range(M):
	p, s = input().split()
	if S[int(p)-1] == 'WA':
		if s == 'AC':
			S[int(p)-1] = 'AC'
			r+=1
		else:
			w+=1

print(r,w)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
sub = [list(input().split()) for _ in range(M)]
A = 0
W = 0
for i in range(1,N+1):
    for k in range(M):
        if (sub[k][0] == str(i)) and (sub[k][1] == "AC"):
            A += 1
            break
        elif (sub[k][0] == str(i)) and (sub[k][1] == "WA"):
            W += 1
            continue
print(A,end=" ")
print(W)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
T=[]
frag=[0 for y in range(N)]
p=0
a=0
for i in range(M):
  s=list(map(str,input().split()))
  T.append(s)
for i in range(M):
  if T[i][1]=='WA' and frag[int(T[i][0])-1]==0:
    p=p+1
  elif T[i][1]=='AC' and frag[int(T[i][0])-1]==0:
    a=a+1
    frag[int(T[i][0])-1]=1
print(a,p)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = [0]*2
tmp = [0]*n
for _ in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if tmp[p-1] == 0:
        if s == 'AC':
            ans[0] += 1
            tmp[p-1] += 1
        elif s == 'WA':
            ans[1] += 1
print(*ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve():
    from sys import stdin
    f_i = stdin
    
    N, M = map(int, f_i.readline().split())
    
    cleared = dict(zip(range(N), [False] * N))
    penalty = dict(zip(range(N), [0] * N))
    
    for i in range(M):
        p, S = f_i.readline().split()
        p = int(p) - 1
        if S == 'AC':
            cleared[p] = True
        elif not cleared[p]:
            penalty[p] += 1
    
    clear_count = list(cleared.values()).count(True)
    penalty_count = sum(penalty.values())
    
    print(clear_count, penalty_count)

solve()

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 151: C (2020/01/12)
N, M = map(int, input().split())
A = [0 for i in range(N)]
p = [0 for i in range(M)]
S = ['' for i in range(M)]
for i in range(M):
    l = input().split()
    p[i] = int(l[0])
    S[i] = str(l[1])
ans = 0
pnlt = 0
for i in range(M):
    if A[p[i]-1] != 0:
        continue
    if S[i] == 'AC':
        ans = ans + 1
        A[p[i]-1] = 1
    else:
        pnlt = pnlt + 1
print(ans, pnlt)

Submission status: Wrong Answer

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

Q = [False] * N
ok = 0
ng = 0
for _ in range(M):
    p,S = map(str,input().split())
    p = int(p)
    S = S.rstrip("\n")
    if not Q[p-1]:
        if S == "AC":
            Q[p-1] = True
            ok += 1
        elif S == "WA":
            ng += 1

print(ok,ng)

Submission status: Wrong Answer

Solution code:
import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
P, S = [], []
for s in inputs[1:]:
    x, y = s.split()
    P.append(int(x)-1)
    S.append(y)

num_ac = num_wa = 0
acs = [0]*n
for p, s in zip(P, S):
    if acs[p]:
        continue
    if s == 'WA':
        num_wa += 1
    else:
        acs[p] = 1
        num_ac += 1
        
print(*[num_ac, num_wa])

Submission status: Wrong Answer

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

dict = {}
for i in range(m):
    p,s=input().split()
    dict.setdefault(p,[]).append(s)

ac_count=0
wa_count=0
for p,s in dict.items():
    for ans in s:
        if ans=='AC':
            ac_count+=1
            is_ac=True
            break
        else:
            wa_count+=1
print(ac_count, wa_count)

Submission status: Wrong Answer

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

seitou=0
pena=0
p1="1"
cont=0
for i in range(m):
    
    p,s=input().split()
    if p!=p1:cont=0
    if cont==0:
        if s=="WA":pena+=1
        if s=="AC":
            seitou+=1
            cont=1    
    p1=p
print(seitou,pena)

Submission status: Wrong Answer

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

ng = [0]*n
ok = [0]*n
for i in range(m):
  if ok[p[i]-1] == 0 and s[i] =='AC':
    ok[p[i]-1] += 1
  elif ok[p[i]-1] == 0 and s[i] =='WA':
    ng[p[i]-1] += 1
print(str(sum(ok)) + ' ' + str(sum(ng)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = []
S = []
for _ in range(M):
    temp = [i for i in input().split()]
    P.append(int(temp[0]))
    S.append(temp[1])
AC = [False] * N
WA = [0] * N
for m in range(M):
    if AC[P[m]-1] == False and S[m] == "AC":
        AC[P[m]-1] = True
    elif AC[P[m]-1] == False and S[m] == "WA":
        WA[P[m]-1] += 1
    elif AC[P[m]-1] == True:
        pass
print(*[sum(AC),sum(WA)])

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ca = [0]*(n+1)
cw = [0]*(n+1)
for i in range(m):
    a,b = map(str,input().split())
    if b == "WA" and ca[int(a)]==0:
        cw[int(a)] += 1
    elif b == "AC":
        ca[int(a)] = 1
print(sum(ca),sum(cw))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

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

submit = np.zeros(n+1)
ac = 0
wa = 0

for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if submit[p] == 1:
        continue
    if s == "WA":
        wa += 1
    else:
        submit[p] = 1
        ac += 1

print(ac, wa)

Submission status: Wrong Answer

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

ans = [0,0]
q = [0]*N
p_count = 0
for i in range(M):
    if S[i] == "WA":
        p_count += 1
    if S[i] == "AC" and q[p[i]-1] ==0:
        ans[0]+= 1
        q[p[i]-1] = 1
        ans[1] += p_count
        p_count = 0
print(*ans)

Submission status: Wrong Answer

Solution code:
import math
import fractions

n, m = map(int, input().split())
ac_list = [0 for _ in range(n)]
wa_list = [0 for _ in range(n)]
wa_cnt = 0
cnt = 1
while cnt <= m:
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac_list[p - 1] = 1
    else:
        if ac_list[p - 1] == 0:
            wa_list[p - 1] += 1
    cnt += 1
for i in range(n):
    if wa_list[i] == 1 and ac_list[i] == 1:
        wa_cnt += 1
print(sum(ac_list), wa_cnt)

Submission status: Wrong Answer

Solution code:
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

import itertools as iter
import math
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N,M = nums()
AC = set()
WA = {}
for _ in range(M):
    pi,si = input().split()
    if si == "AC":
        AC.add(pi)
    else:
        if not (pi in WA.keys()):
            WA[pi] = 1
        elif not (pi in AC):
            WA[pi] += 1
            """
for problem in WA.keys():
    if not (problem in AC):
        WA[problem] = 0
        """
ACnum = len(AC)
WAnum = sum(WA.values())
print(ACnum,WAnum)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
ans = [[] for i in range(N)]
for i in range(M):
    p,s = [(x) for x in stdin.readline().rstrip().split()]
    ans[int(p)-1].append(s)

ac = 0
pe = 0
tmp = 0
flag = False
for j in range(N):
    for k in ans[j]:
        if k == "WA":
            tmp += 1
        else:
            ac += 1
            pe += tmp
            tmp = 0
            break
print(ac,pe)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac,wa=0,0
aced=[0 for _ in range(n)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  if p not in aced:
    if s=='AC':
      ac+=1
      aced[p-1]=p
    else:
      wa+=1
  

print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, m = map(int, input().split())
    ac = set()
    wa = [0] * (n+1)

    for _ in range(m):
        p, s = input().split()
        p = int(p)
        if p in ac:
            continue
        if s == 'AC':
            ac.add(p)
        elif s == 'WA':
            wa[p] += 1
    print(len(ac), sum(wa))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n, m = map(int, input().split())
ac = 0
wa = 0
quest = 0
result = 'WA'

for i in range(m):
    p, s = map(str, input().split())
    if quest == p and result == s and result == 'AC':
        break
    elif quest == p and s == 'WA':
        wa += 1
    elif quest == p and s == 'AC':
        ac += 1
    elif quest != p and s == 'WA':
        wa += 1
    elif quest != p and s == 'AC':
        ac += 1

    quest = p
    result = s

print(ac, wa)

Submission status: Wrong Answer

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

arr = [False]*n
count = 0

for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if arr[p]:
        pass
    else:
        if s == "AC":
            arr[p] = True
        else:
            count += 1

answer = str(sum(arr)) + " " + str(count)
print(answer)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = []
count_WA = 0
count_WA_total = 0
for i in range(M):
    p, S = input().split()
    if p not in li_AC:
        if S == "AC":
            li_AC.append(p)
            count_WA_total += count_WA
            count_WA = 0
        if S == "WA":
            count_WA += 1
print(len(list(set(li_AC))), count_WA_total)

Submission status: Wrong Answer

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

ac = 0
wa = 0

done = dict()

for i in range(M):
    p, S = input().split()
    if p in done:
        continue
    if S == "AC":
        ac+= 1
        done[p] = True
    else:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

memo = [[0] * 2 for _ in range(N)]

answer_AC = 0
answer_WA = 0

for i in range(M):
    if memo[int(pS[i][0]) - 1][0] == 1:
        continue
    elif pS[i][1] == "AC":
        answer_AC += 1
        memo[int(pS[i][0]) - 1][0] = 1
    else:
        answer_WA += 1

print(answer_AC)
print(answer_WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
ac_check=[False for _ in range(n+1)]
for i in range(m):
    p,s=input().split()
    p=int(p)
    if(s=="AC" and (not ac_check[p])):
        ac+=1
        ac_check[p]=True
    elif(s=="WA" and (not ac_check[p])):
        wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

last_ac = 0
er_c = 0
ac_c = 0
ac_list = []
for i in range(M):
    if i == 0:
        if ps[i][1] == 'WA':
            er_c += 1
        else:
            ac_c += 1
            ac_list.append(ps[i][0])
            last_ac = i+1
    elif ps[i][1] == 'WA':
        er_c += 1
    elif ps[i][1] == 'AC':
        last_ac = i+1
        if ps[i][0] not in ac_list:
            ac_c += 1
            ac_list.append(ps[i][0])
if M == 0:
    print(0, 0)
    exit(0)
print(ac_c, er_c-(M-last_ac))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,m = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
P =[]
S =[]

penalty = 0

for i in range(m):
    p,s = map(str, stdin.readline().rstrip().split())
    P.append(int(p))
    S.append(s)

l = [0]*n
for i in range(m):
    status = l[P[i]-1]
    if status == "AC":
        pass
    else:
        if S[i] == "AC":
            l[P[i]-1] = "AC"
        else:
            penalty += 1
count = 0
for i in range(n):
    if l[i] == "AC":
        count+= 1

print(count, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
q_re = {}
ac = 0
wa = 0
for i in range(m):
    q, re = input().split()
    if(re == "WA" and q not in q_re): 
        wa += 1
    if(re == "AC" and q not in q_re): 
        ac += 1
        q_re[q] = "AC"
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
from bisect import *
from collections import *
# from heapq import *
# import functools
# import itertools
# import math
INF = 500000
mod = 10**9+7

N, M = map(int, input().split())
flg = [0] * N
cnt = [0] * N
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if S == 'WA':
        if flg[p] == 0:
            cnt[p] += 1
    else:
        if flg[p] == 0:
            flg[p] = 1
print(sum(flg), sum(cnt))

Submission status: Wrong Answer

Solution code:
import sys

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

if M==0:
    print(0,0)
    sys.exit()
    
L = []

d = {}

for _ in range(M):
    P,S = input().split()
    P = int(P)
    L.append([P,S])

for i in range(M):
    p,s = L[i]
    if p in d:
        if s=="AC" and d[p]["AC"]==0:
            d[p]["AC"] = 1
        elif s=="WA" and d[p]["AC"]==0:
            d[p]["WA"] = d[p]["WA"] + 1
    else:
        d[p] = {}
        d[p]["AC"] = 0
        d[p]["WA"] = 0
        if s=="AC":
            d[p]["AC"] = 1
        elif s=="WA":
            d[p]["WA"] = d[p]["WA"] + 1

ac_count = 0
wa_count = 0

for i in range(1,N+1,1):
    if not (i in d):
        continue    
    ac_count = ac_count + d[i]["AC"]
    wa_count = wa_count + d[i]["WA"]

print(ac_count, wa_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

teishutu = []
for i in range(M):
    pi,si = input().split()
    teishutu.append([pi,si])
    
nWA = 0
nAC = 0
try_dic = {}

for l in teishutu:
    pi,si = l
    if pi in try_dic.keys():
        pisi = try_dic[pi]
        if pisi == "AC":
            pass
        else:
            if si == "WA":
                nWA +=1
            else:
                nAC += 1
                try_dic[pi] = si
    else:
        try_dic[pi]=si
        if si == "AC":
            nAC += 1
        else:
            nWA += 1
            
print(nAC,nWA)

Submission status: Wrong Answer

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

WA = [0] * (10 ** 5 + 1)
AC = [False] * (10 ** 5 + 1)
for i in range(M):
    _no , re = input().split()
    no = int(_no)
    if re == 'AC':
        AC[no] = True
    if not AC[no]:
        if re == 'WA':
            WA[no] += 1

print(AC.count(True), sum(WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
S=[[0, ""] for j in range(M)]
ACcheck=[False for j in range(N)]
AC=0
WA=0
for i in range(M):
  ps = input().split()
  S[i][0]=int(ps[0])
  S[i][1]=ps[1]
for i in range(M):
  if S[i][1]=="AC":
    if ACcheck[S[i][0]-1]==False:
      AC+=1
      ACcheck[S[i][0]-1]=True
  else:
    if ACcheck[S[i][0]-1]==False:
      WA+=1
  
print(AC, WA)