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:
from functools import reduce
N, M = list(map(int, input().split()))
ps_list = [input().split() for _ in range(M)]

result = {}
for row in ps_list:
  if not row[0] in result:
    result[row[0]] = {
        "AC": 0,
        "WA": 0
    }
  if result[row[0]]["AC"] > 0:
    continue
  else:
    result[row[0]][row[1]] = result[row[0]][row[1]] + 1

ac = 0
wa = 0
for k,v in result.items():
  ac = ac + v["AC"]
  wa = wa + v["WA"]

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = (int(x) for x in input().split())
cor = 0
mis = 0
numList = [] * M

for _ in range(M):
    num,res = input().split()
    if num not in numList:
        if res == 'AC':
            cor += 1
            numList.append(num)
        else:
            mis += 1

print(cor,mis)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict

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

wa_cnt = 0
ans = defaultdict(int)
for i in range(M):
    P,S = map(str, input().split())
    if (S == 'AC'):
        ans[P] = 1
    else:
        if (ans[P] != 1):
            wa_cnt +=1


val = ans.values()
print(list(val).count(1), wa_cnt)

Submission status: Wrong Answer

Solution code:
def sum(arg):
  ans = 0
  for i in arg:
    ans += i
  return ans

N, M = map(int, input().split())
ac = [0]*N
wa = [0]*N
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if si == "AC" and ac[pi-1] == 0:
    ac[pi-1] += 1
  elif si == "WA" and ac[pi-1] == 0:
    wa[pi-1] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
slst = sorted(lst, key=lambda x: x[0])
pn = 0
cr = 0
plbnum = 0
for i in slst:
  a = int(i[0])
  if a > plbnum:
    if i[1] == "WA":
      pn += 1
    else:
      cr += 1
      plbnum = a
print(pn, cr)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = [input().split() for _ in range(M)]
X = [0] * N
ac = 0
wa = 0
for pi in P:
    i = int(pi[0])
    s = pi[1]
    if X[i-1] == 0:
        if s == 'WA':
            wa += 1
        else:
            ac += 1
            X[i-1] = 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import numpy as np
DEB = False
N,M = map(int, input().split())
res = np.zeros((N+1,2))

for i in range(M):
    p, s = input().split()
    p = int(p)
    if res[p][0] == 0:
        if s == 'AC':
            res[p][0] += 1
        elif s == 'WA':
            res[p][1] += 1
    
if DEB:
    for r in res:
        print(r)

print("%d %d"%(int(res[1:,0].sum()), int(res[1:,1].sum())))

Submission status: Wrong Answer

Solution code:
hist = []
nm = list(map(int, input().split()))
for i in range(nm[1]):
    a,b=input().split()
    hist.append((int(a), b))

ac = [0] * nm[0]
wa = [0] * nm[0]

for i in range(nm[1]):
    if hist[i][1] == "AC":
        if ac[hist[i][0]-1] != 1:
            ac[hist[i][0]-1] = 1
    elif hist[i][1] == "WA":
        if ac[hist[i][0]-1] != 1:
            wa[hist[i][0]-1] = wa[hist[i][0]-1] + 1

for i in range(nm[0]):
    wa[i] = wa[i] * (1-ac[i])

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

Submission status: Wrong Answer

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


maxac = len(set(p))
ac = s.count('AC')
wa = s.count('WA')

li = []
nocount = 0
for i in set(p):
    if [str(i), 'AC'] in ps:
        num = ps.index([str(i), 'AC'])
        if [str(i), 'WA'] in ps[num:]:
            nextnum = ps[num:].count([str(i), 'WA'])
            nocount += nextnum

if ac >= maxac:
    print(maxac, wa-nocount)
else:
    print(ac, wa-nocount)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
wa_count = [0] * N
ac = [False] * N
rest_ac_num = N

WA = 'WA'

for i in range(M):
    #print()
    #print('wa_count', wa_count)
    #print('ac', ac)
    #print('rest_ac_num', rest_ac_num)
    #print()

    _p, S = input().split(' ')
    p = int(_p) - 1

    if ac[p]:
        continue

    if S == WA:
        wa_count[p] += 1
    else:
        ac[p] = True
        rest_ac_num -= 1

    if rest_ac_num == 0:
        break

wa_total = 0
for c in wa_count:
    wa_total += c

print(N - rest_ac_num, wa_total)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    N, M = map(int, input().split())

    if M == 0:
        print('0 0')
        sys.exit()


    p_S = []
    for i in range(M):
        p_S.append(input().split())

    p_S = list(map(list, set(map(tuple, p_S))))
    print(p_S) 


    ac = 0
    wa = 0
    for arr in p_S:
        if arr[1] == 'AC':
            ac += 1
        else:
            wa += 1

    print(ac, wa)

main()

Submission status: Wrong Answer

Solution code:
mondai,kaitou = map(int,input().split())

#問題ごとのList
clearNo = []
cleard = 0
pena = 0
#解答数分繰り返す
for i in range(kaitou):
    qNo,kaitou = input().split()
    qNo = int(qNo)
    if qNo in clearNo:
        continue
    else:
        if kaitou == 'WA':
            pena +=1
        else:
            cleard += 1
            clearNo.append(qNo)

print(str(cleard) + ' ' + str(pena))

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 = []
wa_c = 0
counter = 0
for i in range(m):
    p,s = map(str,input().split())
    if s =="AC":
        dic[p] = "AC"
        ac_dic[p] = "AC"

    #if dic[p] == "0":
    #    counter = 0
    if s == "WA" and dic[p] != "AC":
    #    wa_L.append(1)
    #    dic[p] = "WA"
        wa_c += 1


#print(ac_dic)
print(len(ac_dic),wa_c)

Submission status: Wrong Answer

Solution code:
def solve(N, M, A):
    if M == 0:
        return 0, 0
    A = [[int(x[0]), x[1]] for x in A]
    a = 0
    w = 0
    ac = 0
    wa = 0
    check = 0
    num = A[0][0]
    for i in range(M):
        if A[i][0] == num and A[i][1] == 'WA' and not check:
            w += 1
        elif A[i][0] == num and A[i][1] == 'AC' and not check:
            check = 1
            ac += 1
            wa += w
            w = 0
        if A[i][0] != num:
            num = A[i][0]
            check = 0
            if A[i][1] == 'WA' and not check:
                w += 1
            elif A[i][1] == 'AC' and not check:
                check = 1
                ac += 1
                wa += w
                w = 0

    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# ABC151 C

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

for i in range(M):
    tmp_p, tmp_S = input().split()
    p.append(int(tmp_p))
    S.append(tmp_S)

for q, res in zip(p, S):
    if res == "WA":
        if AC[q-1] != 0:
            continue
        else:
            WA[q-1] += 1
    else:
        if AC[q-1] == 1:
            continue
        else:
            AC[q-1] += 1

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
dp = [0]*(100010)
qp = [0]*(100010)
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if qp[ta] == 0 :
        if tb == 'WA':
            dp[ta]+=1
        else :
            qp[ta]=1
print(sum(qp),sum(dp))

Submission status: Wrong Answer

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

idx = list(range(N+1))
AC = 0
WA = 0
for i in range(len(ps)):
    if idx[int(ps[i][0])] != "AC":
        if ps[i][1] == "AC":
            AC += 1
            idx[int(ps[i][0])] = "AC"
        else:
            WA += 1

print(str(AC) + " " + str(WA))

Submission status: Wrong Answer

Solution code:
if __name__=="__main__":
    n, m = map(int, input().split())
    p, s=[], []
    for i in range(m):
        pin, sin = map(str, input().split())
        p.append(int(pin))
        s.append(sin)

    cnt_wa = 0
    cnt_ac = 0
    ac_gotten = False
    for i in range(m):

        if i>=1 and ac_gotten and p[i]>p[i-1]:
            ac_gotten = False

        if not ac_gotten:
            if s[i]=="WA":  
                cnt_wa += 1
            else:
                cnt_ac += 1
                ac_gotten = True
                if ac_gotten and p[i]==n:
                    break
        
    print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

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

count_wa = 0
flag_ac = [False]*n
for i in l:
    if not flag_ac[int(i[0])-1]:
        if i[1] == "AC":
            flag_ac[int(i[0])-1] = True 
        elif i[1] == "WA":
            count_wa += 1

print(sum(flag_ac), count_wa)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
p, S = [], []
solved = {}
failed = {}
for _ in range(M):
    x = input().split()
    if x[1] == 'AC':
        if x[0] in solved:
            pass
        else:
            solved[x[0]] = 1
    else:
        if not x[0] in solved:
            if x[0] in failed:
                failed[x[0]] += 1
            else:
                failed[x[0]] = 1

print(sum(solved.values()), sum(failed.values()))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    a = [0] * N
    w = [0] * N

    for _ in range(M):
        p, s = map(str, input().split())
        if a[int(p) - 1] == 1:
            continue
        if s == "AC":
            a[int(p) - 1] = 1
        elif s == "WA":
            w[int(p) - 1] += 1

    print(sum(a), sum(w))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split( ))
wa = [0] * (n + 1)
ac = [0] * (n + 1)
for i in range(m):
    no_s, res = map(str, input().split( ))
    no = int(no_s)
    if ac[no] == 0 and res == "AC":
        ac[no] = 1
    elif ac[no] == 0 and res == "WA":
        wa[no] += 1
acsum = 0
wasum = 0
for i in ac:
    acsum += i
for i in wa:
    wasum += i
print(str(acsum) + " " + str(wasum))

Submission status: Wrong Answer

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

	num = []
	ans = []
	for i in range(m):
		na,a = input().split()
		num.append(na)
		ans.append(str(a))
	
	ac = 0
	wa = 0
	ac_temp = []
	wa_temp = 0
	for i in range(m):
		if i > 0 and ans[i] == "WA" and num[i] != num[i-1]:
			wa_temp = 1
		elif ans[i] == "WA":
			wa_temp += 1
		elif ans[i] == "AC" and ac_temp.count(num[i]) == 0:
			ac += 1
			wa += wa_temp
			wa_temp = 0
			ac_temp.append(num[i])

	print(ac,wa)






 
if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
List = [0]*N
correct , penalties = 0,0
for i in range(M):
    p,s = input().split()
    pro = int(p)-1
    if pro > len(List):
        penalties+=1
        continue
    if List[pro]=="AC":
        continue
    if s == "WA":
        penalties+=1
        List[pro]=s
    else:
        List[pro]=s
        correct+=1
if(M>0):
    print("%d %d"%(List.count("AC"),penalties))
else:
    print(0,0)

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())
P=[]
A=[]
for i in range(M):
    n,a=input().split()
    P.append(int(n))
    A.append(a)

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

print(a,p)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input() for _ in range(m)]
p = [0] * m
s = [''] * m
for i in range(m):
  x, y = ps[i].split()
  p[i] = int(x)
  s[i] = y
ac_flag = [0]*n # AC出したかどうかのflag
ac_count = 0
wa_count = 0
for j in range(m):
  if ac_flag[p[j]-1] == 1:
    continue
  if s[j] == 'AC':
    ac_flag[p[j]-1] = 1
    ac_count+=1
  if s[j] == 'WA':
    wa_count+=1
print(ac_count,wa_count)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
q = []
j = 1

seitou = 0
pena = 0

for i in range(M):
    p, s = input().split()
    if int(p) >= j:
        if s == "AC":
            j = int(p) + 1
            seitou += 1
        if s == "WA":
            pena += 1
else:
    print(seitou, pena)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N,M = map(int, readline().decode("utf-8").split())

aclist = [0 for _ in range(0, N+1)]
walist = [0 for _ in range(0, N+1)]

for _ in range(0, M):
    p,s = readline().decode('utf-8').split()
    p = int(p)

    if s == "AC":
        aclist[p] = 1
    if s == "WA" and aclist[p] == 0:
        walist[p] += 1

print(sum(aclist), sum(walist))

Submission status: Wrong Answer

Solution code:

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

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

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

print(a,b)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
quest = []
if m == 0:
    pass
else:
    for i in range(m):
        a,b=input().split()
        quest.append([int(a), b])
wa = 0
ac = 0
ans = [0]*n
for j in range(m):
    if quest[j][1] == "AC":
      if  ans[int(quest[j][0]-1)] != 1:
        ac += 1
        ans[int(quest[j][0]-1)] = 1
    else:
        if ans[int(quest[j][0]-1)] == 1:
            pass
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

key = [False]*n
ac, wa = 0, 0
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if s == "WA":
        if key[p-1]:
            continue
        else:
            wa += 1
    if s == "AC":
        if key[p-1]:
            continue
        else:
            ac += 1
            key[p-1] = True
print(ac, wa)

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
        if Q[i][1]=="AC":
            flag[int(Q[i][0])-1]=1
    
    #ans=sum(c)
    #ansAC=sum(flag)
    
    ans=0
    ansAC=0
    for i in range(N):
        ans+=c[i]
        ansAC+=flag[i]
    #print(int(ansAC), int(ans))
    print('{:.15g}'.format(ansAC),'{:.15g}'.format(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:
n, m = map(int, input().split())

tasks = [] # [0]がAC、[1]がWA数
for i in range(n):
    tasks.append([0, 0])

sub = []
for i in range(m):
    i, j = map(str, input().split())
    i = int(i)
    sub.append([i, j])

penal = 0
ac = 0
for p, s in sub:
    if tasks[p-1][0] == 1:
        continue
    else:
        if s == "AC":
            ac += 1
            tasks[p-1][0] = 1
        else:
            penal += 1

P = 0
for i, j in tasks:
    if i:
        P += j
print(ac, P)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
t = dict()
account,pena = 0,0
for i in range(m):
	s = input().split()
	if not s[0] in t.keys():
		t[s[0]] = s[1]
	else:
		if t[s[0]] == 'WA':
			t[s[0]] += s[1]
for j in t.values():
	if j[-2::] == 'AC':
		account += 1
		pena += j.count('WA')
print(account,pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = [list(input().split()) for i in range(M)]
PS = [[int(PS[i][0])-1,PS[i][1]] for i in range(M)]
AC = [0]*N
WA = [0]*N

for i in range(M):
    print(PS[i][0])
    if AC[PS[i][0]] == 0:
        if PS[i][1] == "AC":
            AC[PS[i][0]] = 1
        else:
            WA[PS[i][0]] += 1
        # print(AC,WA)
w = 0
for i in range(N):
    if AC[i] == 1:
        w += WA[i]
print(sum(AC),w)

Submission status: Wrong Answer

Solution code:
N, M = input().split()
N = int(N)
M = int(M)
p = []
S = []
for i in range(M):
    a, b = input().split()
    a = int(a)
    p.append(a)
    S.append(b)
right = []
wrong = []
for j in range(N):
    right.append(0)
    wrong.append(0)
for k in range(M):
    if S[k] == 'WA' and right[p[k] - 1] == 0:
        wrong[p[k] - 1] = wrong[p[k] - 1] + 1
    else:
        if right[p[k] - 1] == 0:
            right[p[k] - 1] = right[p[k] - 1] + 1
print(str(sum(right)) + ' ' + str(sum(wrong)))

Submission status: Wrong Answer

Solution code:
from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def main():
    N, M = [int(x) for x in input().split()]
    isAC = [False] * (N+1)
    cntWA = [0] * (N+1)
    cntAC = 0
    cntPN = 0
    for i in range(M):
        p, s = input().split()
        p = int(p)
        if not isAC[p]:
            if s == "AC":
                isAC[p] = True
                cntAC += 1
            else:
                cntWA[p] += 1
    for i in range(1, N+1):
        if isAC[i]:
            cntPN += cntWA[p]

    return " ".join([str(cntAC), str(cntPN)])


if __name__ == "__main__":
    print(main())

Submission status: Wrong Answer

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

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

print ("%d %d" % (sum(ac),sum(wa)))

Submission status: Wrong Answer

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

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

fin=[0]*(N+1)
count_AC=0
count_WA=0

if(M!=0):
    for i in range(0,M):
        if(S[i]=="AC"):
            if(fin[int(p[i])]!=1):
                count_AC+=1
                fin[int(p[i])]=1
        else:
            if(fin[int(p[i])]!=1):
                count_WA+=1
    
    print(count_AC,count_WA)

else:
    print(count_AC,count_WA)

Submission status: Wrong Answer

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

ac = 0
wa = 0
acflag = False
pre = -1

if m == 0:
    print("0 0")
    exit()

for i in range(m):
    a,b = input().split()
    p.append(a)
    s.append(b)

pre = p[0]
for i in range(m):
    if pre != p[i]:
        acflag = False
    
    if acflag == False:
        if s[i] == "WA":
            wa += 1
        elif s[i] == "AC":
            ac += 1
            acflag = True

    pre = p[i]

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

Submission status: Wrong Answer

Solution code:
buf=input().split(" ")
 
N=int(buf[0])
M=int(buf[1])
clear=[]
ac=0
wa=0

for i in range(M):
  buf=input().split(" ")
  if clear.count(int(buf[0])) == 0:
    if buf[1] == "AC":
      clear.append(int(buf[0]))
      ac=ac+1
    elif buf[1] == "WA":
      wa=wa+1
print(str(ac)+" "+str(wa))

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] = input().split()

sum_ok = 0
sum_miss = 0
former_ok = [0]*n
for i in range(m):
    # すでに正解でない物で正解
    if p[i] in former_ok:
        continue
    elif s[i] == 'AC' and p[i] not in former_ok:  
        former_ok[sum_ok] = p[i]
        sum_ok += 1
        if sum_ok == n:
            break
    # すでに正解でないもので不正解
    elif s[i] == 'WA' and p[i] not in former_ok:
        sum_miss += 1
    else:
        continue 
print(sum_ok, sum_miss)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd

ac = dd(bool);pen,cor=0,0
n,m = map(int,input().split())

for i in range(m):
	l = input().split()
	p = int(l[0]);ans=l[1]
	if ac[p]==False and ans=='WA':
		pen+=1
	elif ac[p]==False and ans=='AC':
		cor+=1
		ac[p]=True
		
print(cor,"",pen)

Submission status: Wrong Answer

Solution code:
mondaisu , teisyutukaisu = map(int,input().split())

flag = []

for i in range(mondaisu):
  flag.append(0)

pena = 0


for i in range(teisyutukaisu):
  bango , kekka = input().split()
  bango = int(bango)
  if flag[bango-1] == 1:
    continue
  if kekka == 'WA':
    pena = pena + 1
  if kekka == 'AC':
    flag[bango-1] = 1
  
print(sum(flag),pena)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
colect_quest = [0]*N
WA_quest = [0]*N
for i in range(M):
    pi,si = list(map(str,input().split()))
    pi = int(pi)
    if si == "AC":
        colect_quest[pi-1] = 1
    if si == "WA" and colect_quest[pi-1] != 1:
        WA_quest[pi-1] += 1
    
print(sum(colect_quest),sum(WA_quest))

Submission status: Wrong Answer

Solution code:
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

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

if m == 0:
  print('0 0')
  
s = [input().split() for i in range(m)]

p = get_unique_list(s)

ac = 0
w = []
wa = 0

for i in range(len(p)):
  if p[i][1] == 'AC':
    ac += 1
    w.append(wa)
    wa = 0
  elif p[i][1] == 'WA':
    wa += 1
print(str(ac)+" "+str(sum(w)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
count = 0
ans = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        ans.append(p[i])
        ans = list(set(ans))
    elif x[i] == "WA":
        for j in range(len(ans)):
            if p[i] == ans[j]:
                penal -= 1
                break
        penal += 1
    if len(ans) == n:
        break

if penal < 0:
    penal = 0

print("{}".format(len(ans)) + " {}".format(penal))

Submission status: Wrong Answer

Solution code:

import numpy as np

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

counter = {}

for i in range(m):
    res = list(input().split())
    p, s = (int(res[0]), res[1])
    if p in counter.keys():
        if s == 'AC':
            counter[p][0] = 1
        elif s == 'WA' and (not counter[p][0]):
            counter[p][1] += 1
    else:
        if s == 'AC':
            counter[p] = np.array([1, 0])
        else:
            counter[p] = np.array([0, 1])

if len(counter):
    print(*sum(counter.values()))
else:
    print('0 0')

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
tasks = []
for i in range(M):
  a, b = map(str,input().split())
  tasks.append([int(a),b])
AC = 0
WA = 0

try:
  for i in range(len(tasks)):
    num = tasks[i][0]
    if tasks[i][1]=="AC":
      AC += 1
      for j in range(i+1,len(tasks)):
        if tasks[j][0]==tasks[i][0]: del tasks[j]
    else: 
      for j in range(i+1,len(tasks)):
        if tasks[j]==[i,"AC"]: WA += 1
except IndexError: pass
print(AC, WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ansa=0
lip,lis=[],[]
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s=map(str,input().split())
        lip.append(p)
        lis.append(s)
        if s=="AC":
            if next!=p:
                ansa+=1
                next= p 
    while lis[len(lis)-1] == "WA":
        lis[len(lis)-1]=[]
    print(ansa,lis.count("WA"))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
p, S = [], []
solved = {}
failed = {}
for _ in range(M):
    x = input().split()
    if x[1] == 'AC':
        if x[1] in solved:
            solved[x[0]] = +1
        else:
            solved[x[0]] = 1
    else:
        if not x[0] in solved:
            if x[0] in failed:
                failed[x[0]] += 1
            else:
                failed[x[0]] = 1

print(sum(solved.values()), sum(failed.values()))

Submission status: Wrong Answer

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

list = [input().split() for _ in range(M)]

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

for i in range(M):
  if list[i][1] == "AC":
    ac_list[int(list[i][0])-1] = 1
  else:
    if ac_list[N-1] == 0:
      wa_list[int(list[i][0])-1] += 1

for i in range(N):
  if ac_list[i] == 0:
    wa_list[i] = 0

print(sum(ac_list), sum(wa_list))

Submission status: Wrong Answer

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

rlt = {}
for i in range(m):
    ipt = input().split()

    if rlt.get((int(ipt[0]), ipt[1])) is None:
        rlt[(int(ipt[0]), ipt[1])] = 1
    elif (int(ipt[0]), "AC") not in rlt:
            rlt[(int(ipt[0]), ipt[1])] += 1

collect = 0
false = 0
for k, v in rlt.items():
    if k[1] == "AC":
        collect += 1
    else:
        false += 1
print(collect, false)

Submission status: Wrong Answer

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

for i in range(m):
    t1, t2 = input().split()
    s.append([t1, t2])

sorted(s, key=lambda x:x[0])

t = ''
ac = 0
wa = 0
awa = 0
cIsSolved = False
for i in range(m):
    if s[i][0] != t:
        t = s[i][0]
        cIsSolved = False
        wa = 0
    if s[i][1] == 'AC' and not cIsSolved:
        cIsSolved = True
        ac += 1
        awa += wa
    if s[i][1] == 'WA':
        if not cIsSolved:
            wa += 1
print(ac, awa)

Submission status: Wrong Answer

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

AC_no_list = []
WA_all_list = []
# １行ずつ見ていく
for i in range(M):
    WA_list = [] # tmp のWAリストを初期化
    if P[i][1] == "AC":
        AC_no = P[i][0]
        if AC_no not in AC_no_list:
            AC_no_list.append(AC_no)
            c_list = P[:i]
            WA_list = [P[i] for i in range(len(P)) if P[i][0] == AC_no and P[i][1] == "WA"]
            if len(WA_list) > 0:
                WA_all_list.append(WA_list)
print(str(len(AC_no_list)) + " " + str(len(WA_all_list)))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ans = 0
wa = 0
li = [[i] for i in range(n)]
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if "AC" not in li[p-1]:
    li[p-1].append(s)
print(li)
for i in li:
  if "AC" in i:
    ans += 1
    wa += i.count("WA")

print(ans,wa)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = list(map(int, readline().split()))
p = []
acc = 0
tmp_cnt = 0

AC_list = []
AC_cnt = 0
WA_cnt = 0
for i in range(M):
    _p, s = readline().decode('utf-8').split()
    if _p != acc:
        tmp_cnt = 0
        acc = _p
    if s == 'AC':
        if _p not in AC_list:
            AC_cnt += 1
            WA_cnt += tmp_cnt
            AC_list.append(_p)
    else:
        tmp_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans = []
ans_0 = []
for i in range(m):
    ans_0 = list(map(str, input().split()))
    ans.append(ans_0)
list0 = []
for j in range(n):
    list0.append(0)
sei = 0
pen = 0
for lis in ans:
    if list0[int(lis[0])-1] == 0:
        if lis[1] == "AC":
            sei += 1
            list0[int(lis[0])-1] = 1
        else:
            pen += 1
    else:
        pass
print(str(sei)+" "+str(pen))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p=[]
S=[]
d={"WA":-1,"AC":1}
for _ in range(M):
    i,j= input().split()
    p.append(int(i)-1)
    S.append(d[j])
    
status = [False for _ in range(N)]

wa = 0
ac = 0
for i in range(M):
    if not status[p[i]]:
        if S[i]==-1:
            wa += 1
        else:
            ac += 1
            status[p[i]] = True
    else:
        pass
print(ac,wa)

Submission status: Wrong Answer

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

ans_list = [0]*(N+1)
pen_num = 0
cor_num = 0

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if (ans_list[p_i] == 0):
    if(S_i == "WA"):
      pen_num += 1
    elif(S_i == "AC"):
      cor_num += 1
      ans_list[p_i] = 1
      
print("{} {}".format(cor_num,pen_num))