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())
row=m
number=[0]
judgment=[0]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * (n+1)
if m > 0:
    for i in range(0,m+1):
        if kuria[number[i]] == 0 and judgment[i] == 'AC':
            seitou += 1
            kuria[number[i]] = 1
        elif kuria[number[i]] == 0 and judgment[i] == 'WA':
            sippai += 1
else:
    pass
print(seitou,sippai)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
wa = 0
ac = 0
flag = 1
wa_flag = 0
ac_flag = 0
for i in range(m):
  if flag != ps[i][0]:
    flag = ps[i][0]
    wa_flag = 0
    ac_flag = 0
  if ps[i][1] == "AC" and ac_flag == 0:
    ac += 1
    wa += wa_flag
    wa_flag = 0
    ac_flag = 1
  if ps[i][1] == "WA":
    wa_flag += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * (n+1)
for i in range(0,len(judgment)):
    if kuria[number[i]] == 0 and judgment[i] == 'AC':
        seitou += 1
        kuria[number[i]] = 1
    elif kuria[number[i]] == 0 and judgment[i] == 'WA':
        sippai += 1
print(seitou,sippai)

Submission status: Wrong Answer

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

p_count = [0] * N
freeze_flags = [False] * N

for i in range(M):
    p_num, result = input().split()
    p_num = int(p_num)
    if result == "AC":
        freeze_flags[p_num -1] = True
    elif freeze_flags[p_num -1] is False:
        p_count[p_num -1] += 1

a_sum = 0
for a in freeze_flags:
    if a:
        a_sum += 1

p_sum = 0
for p in p_count:
    p_sum += p

print(a_sum, p_sum)

Submission status: Wrong Answer

Solution code:
def solve(string):
    n, m, *ps = string.split()
    n = int(n)
    ac = [0] * n
    wa = [0] * n
    for p, s in zip(*[iter(ps)] * 2):
        p = int(p)
        if s == "AC":
            ac[p - 1] = 1
        elif not ac[p - 1]:
            wa[p - 1] += 1
    return "{} {}".format(sum(ac), sum(wa))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Wrong Answer

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

ans = 0
pen = 0
ans_done = []
for i in range(M):
  p,S = raw_input().split()
  if p in ans_done:
    continue
  if S == "WA":
    pen = pen + 1
  else:
    ans = ans + 1
    ans_done.append(p)
print ans,pen

Submission status: Wrong Answer

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

ans = 0
pen = 0
ans_done = []
for i in range(M):
  p,S = list(raw_input().split())
  if p in ans_done:
    continue
  if S == "WA":
    pen = pen + 1
  else:
    ans = ans + 1
    ans_done.append(p)
print ans,pen

Submission status: Wrong Answer

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

pe = 0
thispe = 0
acset = set()
peset = set()

if m > 0:
    for i,name in enumerate(ps):
        p1,s1 = name
        if s1 == "AC":
            acset.add(p1)
            pe += thispe
            thispe = 0
        elif p1 not in acset:
            if p1 not in peset:
                thispe = 0
            peset.add(p1)
            thispe += 1

ac = len(acset)
print(" ".join(list(map(str, [ac, pe]))))

Submission status: Wrong Answer

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

pe = 0
thispe = 0
acset = set()
peset = set()

if m > 0:
    for i,name in enumerate(ps):
        p1,s1 = name
        if s1 == "AC":
            acset.add(p1)
            pe += thispe
            thispe = 0
        elif p1 not in acset:
            peset.add(p1)
            thispe += 1

ac = len(acset)
print(" ".join(list(map(str, [ac, pe]))))

Submission status: Wrong Answer

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

pe = 0
acset = set()

if m > 0:
    for i,name in enumerate(ps):
        p1,s1 = name
        if s1 == "AC":
            acset.add(p1)
        elif p1 not in acset:
            pe += 1

ac = len(acset)
print(" ".join(list(map(str, [ac, pe]))))

Submission status: Wrong Answer

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

for i in range(m):
    p, s = input().split()
    p = int(p) - 1

    if s == "AC" and done[p] == False:
        ac += 1
        done[p] = True
    
    if s == "WA" and done[p] == False:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

dones = set()
wa = buff = 0
for _ in range(M):
    p, S = input().split()
    if p not in dones:
        if S == 'AC':
            dones.add(p)
            wa += buff
            buff = 0
        else:
            buff += 1
print(len(dones), wa)

Submission status: Wrong Answer

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

AC = 0
WA = 0


status = [True] * N
tmp_wa = 0

for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if status[p]:
        if s == 'AC':
            AC += 1
            status[p] = False
            WA += tmp_wa
            tmp_wa = 0
        else:
            tmp_wa += 1

print(AC, WA)

Submission status: Wrong Answer

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

acs = set()
wa = was = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in acs:
        if S == 'AC':
            acs.add(p)
            wa += was
            was = 0
        else:
            was += 1
print(len(acs), wa)

Submission status: Wrong Answer

Solution code:
'n(問題数), m(提出数)を抽出'
n, m = (int(x) for x in input().split())
d = {}
p = 0
p_final = 0

'Piが"WA"の場合はペナルティをカウント, Siが新規かつ、Piが"AC"の場合辞書に追加'
for _ in range(m):
  a, b = (input().split())
  if a not in d:
    if b == 'WA':
      p += 1
      continue
    if b == 'AC':
      d[a] = b
      p_final = p
      continue
  else:
    continue

'辞書の要素数をカウントして正答数を計算、ペナルティはそのまま出力'
print(len(d), p_final)

Submission status: Wrong Answer

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

AC = 0
WA = 0


status = [True] * N

for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if status[p]:
        if s == 'AC':
            AC += 1
            status[p] = False
        else:
            WA += 1

print(AC, WA)

Submission status: Wrong Answer

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

acs = set()
wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        acs.add(p)
    elif p not in acs:
        wa += 1
print(len(acs), wa)

Submission status: Wrong Answer

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

ac = set()
wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        ac.add(p)
    elif S == 'WA' and p not in ac:
        wa += 1
print(len(ac), wa)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split()]

obj = {}
ii = 0
jj = 0

for i in range(M):
    p = [x for x in input().split()]
    key = p[0]
    res = p[1]
    if key not in obj:
        obj[key] = {'AC': 0, 'WA': 0}
    if res == 'WA' and obj[key]['AC'] > 0:
        obj[key]['WA'] = obj[key]['WA'] + 1
    if res == 'AC':
        obj[key]['AC'] = 1

for k in obj:
    ii = ii + obj[k]['AC']
    jj = jj + obj[k]['WA']


print(ii, jj)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split()]

obj = {}
ii = 0
jj = 0

for i in range(M):
    p = [x for x in input().split()]
    key = p[0]
    res = p[1]
    if key not in obj:
        obj[key] = {'AC': 0, 'WA': 0}
    if res == 'WA' and obj[key]['AC'] == 0:
        obj[key]['WA'] = obj[key]['WA'] + 1
    if res == 'AC':
        obj[key]['AC'] = 1

for k in obj:
    ii = ii + obj[k]['AC']
    jj = jj + obj[k]['WA']


print(ii, jj)

Submission status: Wrong Answer

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

d = []
ac = wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in d:
        if S == 'AC':
            d.append(p)
            ac += 1
        elif S == 'WA':
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

x = [0] * N
ac = wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if x[p-1] == 0:
        if S == 'AC':
            x[p-1] = 1
            ac += 1
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

q = set()
ac = wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in q:
        if S == 'AC':
            q.add(p)
            ac += 1
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = input().split()
m = int(m)
if m == 0:
    print("0 0")
else:
    penalty = {}
    score = {}
    last = False
    for i in range(0, m):
        b = input().split()
        if b[1] == 'AC':
            score[b[0]] = 1
            last = True
        elif b[1] == 'WA':
            if last and b[0] in penalty.keys():
                continue
            else:
                if b[0] not in penalty.keys():
                    penalty[b[0]] = 1
                else:
                    penalty[b[0]] += 1
            last = False
    print(str(sum(score.values())) + " " + str(sum(penalty.values())))

Submission status: Wrong Answer

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

for i in range(M):
  num, result = map(str, input().split())
  num = int(num)-1
  
  if ac[num]==0 and result=='AC':
    ac[num] += 1
    
  elif ac[num]==0 and result=='WA':
    wa[num] +=1

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

Submission status: Wrong Answer

Solution code:
'n(問題数), m(提出数)を抽出'
n, m = (int(x) for x in input().split())
d = {}
p = 0

'Piが"WA"の場合はペナルティをカウント, Siが新規かつ、Piが"AC"の場合辞書に追加'
for _ in range(m):
  a, b = (input().split())
  if a not in d:
    if b == 'WA':
      p +=1
      continue
    if b == 'AC':
      d[a] = b
      continue
  else:
    continue

'辞書の要素数をカウントして正答数を計算、ペナルティはそのまま出力'
print(len(d), p)

Submission status: Wrong Answer

Solution code:
n, m = input().split()
m = int(m)
if m == 0:
    print("0 0")
else:
    penalty = {}
    score = 0
    last = False
    for i in range(0, m):
        b = input().split()
        if b[1] == 'AC':
            if b[0] not in penalty.keys():
                score += 1
                penalty[b[0]] = 0
            last = True
        elif b[1] == 'WA':
            if last and b[0] in penalty.keys():
                continue
            else:
                if b[0] not in penalty.keys():
                    penalty[b[0]] = 1
                else:
                    penalty[b[0]] += 1
            last = False
    print(str(score) + " " + str(sum(penalty.values())))

Submission status: Wrong Answer

Solution code:
'n(問題数), m(提出数)を抽出'
n, m = (int(x) for x in input().split())
d = {}
p = 0

'Siが新規かつ、Piが"AC"の場合辞書に追加, Piが"WA"の場合はペナルティをカウント'
for _ in range(m):
  a, b = (input().split())
  if a in d:
    continue
  elif b == 'WA':
    p += 1
  else:
    d[a] = b

'辞書の要素数をカウントして正答数を計算、ペナルティはそのまま出力'
print(len(d), p)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#print("<input>") #
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

#print("<test>") #
#print("A=",A) #

nAC=0
nWA=0
inWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            inWA+=1
            nWA+=1
            if j==len(A[i])-1:
                nWA-=inWA
                break
            else:
                pass
            j+=1
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
        inWA=0

#print("<ans>") #
print("{:1}{:2}".format(nAC,nWA))

Submission status: Wrong Answer

Solution code:
print("<input>") #
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

print("<test>") #
print("A=",A) #

nAC=0
nWA=0
inWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            inWA+=1
            nWA+=1
            if j==len(A[i])-1:
                nWA-=inWA
                break
            else:
                pass
            j+=1
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
        inWA=0
        
print("<ans>") #
print("{:1}{:2}".format(nAC,nWA))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

nAC=0
nWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            nWA+=1
            if j==len(A[i])-1:
                break
            else:
                pass
            j+=1
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
print("{:1}{:2}".format(nAC,nWA))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
won = set()
penalties = 0
for i in range(m):
  x = input().split()
  ID = x[0]
  stat = x[1]
  if ID in won:
      continue
  if stat == "WA":
        penalties += 1
  else:
    won.add(ID)
print(len(won), penalties)

Submission status: Wrong Answer

Solution code:
NM = input().split()
N = int(NM[0])
M = int(NM[1])
prob = []
probStatus = []
for i in range(M):
    pS = input().split()
    prob.append(int(pS[0]))
    probStatus.append(pS[1])
correct = 0
penalty = 0
submissions = [''] * N
for i in range(M):
    if probStatus[i] == 'AC' and submissions[prob[i] - 1] == '':
        correct += 1
        submissions[prob[i] - 1] = 'AC'
    elif probStatus[i] == 'AC' and submissions[prob[i] - 1] == 'AC':
        correct += 1
    elif probStatus[i] == 'WA' and submissions[prob[i] - 1] == '':
        penalty += 1
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
NM = input().split()
N = int(NM[0])
M = int(NM[1])
prob = []
probStatus = []
for i in range(M):
    pS = input().split()
    prob.append(int(pS[0]))
    probStatus.append(pS[1])
correct = 0
penalty = 0
submissions = [''] * N
for i in range(M):
    if probStatus[i] == 'AC' and submissions[prob[i] - 1] == '':
        correct += 1
        submissions[prob[i] - 1] = 'AC'
    elif probStatus[i] == 'WA' and submissions[prob[i] - 1] == '':
        penalty += 1
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l=[]
prevID = ""
accepted = False
penalties = 0
total = 0
for i in range(m):
  x = input().split()
  ID = x[0]
  stat = x[1]
  if ID != prevID:
    accepted = False
  if ID == prevID and accepted:
    continue
  if stat == "AC":
    total += 1
    accepted = True
  else:
    penalties += 1
  prevID = ID

print(total, penalties)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = [0] * (N + 1)
ac = 0
wa = 0
for _ in range(M):
    p, S = input().split()
    if S == 'WA':
        if l[int(p)] >= 0:
            l[int(p)] += 1
    else:
        if l[int(p)] >= 0:
            wa += l[int(p)]
            ac += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = [False] * N
ac = 0
wa = 0
for _ in range(M):
    p, S = input().split()
    w = 0
    if not l[int(p) - 1]:
        if S == 'AC':
            ac += 1
            l[int(p) - 1] = True
            wa += w
            w = 0
        else:
            w += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = [False] * N
ac = 0
wa = 0
for _ in range(M):
    p, S = input().split()
    if not l[int(p) - 1]:
        if S == 'AC':
            ac += 1
            l[int(p) - 1] = True
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])

ans = [0]*NM[0]
ac = 0
for i in range(NM[1]):
    if ps[i][1] == "AC" and flg[ps[i][0]-1]:
        flg[ps[i][0]-1] = False
        ans[ps[i][0]-1] = a[ps[i][0]-1]
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1

for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(ans)-ac)

Submission status: Wrong Answer

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])


ac = 0
for i in range(NM[1]):
    if ps[i][1] == "AC":
        flg[ps[i][0]-1] = False
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1


for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(a))

Submission status: Wrong Answer

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])


ac = 0
for i in range(NM[1]):
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1
    else:
        flg[ps[i][0]-1] = False

for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(a))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
A = [list(map(str, input().split())) for _ in range(M)]
ctr, tmp, AC, WA = 0, 0, 0, 0
flag = False

for i in range(1, N + 1):
    flag = False
    for j in range(ctr, M):
        if int(A[j][0]) == i and A[j][1] == 'WA' and flag == False:
            tmp += 1
            WA += 1
        elif int(A[j][0]) == i and A[j][1] == 'AC' and flag == False:
            tmp += 1
            AC += 1
            flag = True
        elif int(A[j][0]) == i and flag == True:
            tmp += 1
        else:
            ctr = tmp
            break
print(AC, WA)

Submission status: Wrong Answer

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(input().split())
    except:
        break;
        
N = int(listA[0][0])
M = int(listA[0][1])

ans = [0] * N
pena = [0] * N

for i in range(1, M):
    num=int(listA[i][0]) -1
    res=listA[i][1]
    if res=="WA" and ans[num] == 0:
        pena[num] =  pena[num]+1
    if res=="AC" and ans[num] == 0:
        ans[num] = 1
        
print('%d %d' % (sum(ans), sum(x*y for x,y in zip(ans,pena)  ) ))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
A = [list(map(str, input().split())) for _ in range(M)]
ctr, AC, WA = 0, 0, 0
flag = False

for i in range(1, M + 1):
    flag = False
    for j in range(ctr, M):
        if int(A[j][0]) == i and A[j][1] == 'WA' and flag == False:
            ctr += 1
            WA += 1
        elif int(A[j][0]) == i and A[j][1] == 'AC' and flag == False:
            ctr += 1
            AC += 1
            flag = True
        elif int(A[j][0]) == i and flag == True:
            ctr += 1
        else:
            break
        #print(ctr, AC, WA)
print(AC, WA)

Submission status: Wrong Answer

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(input().split())
    except:
        break;
        
N = int(listA[0][0])
M = int(listA[0][1])

ans = [0] * N
pena = [0] * N

for i in range(1, M):
    num=int(listA[i][0]) -1
    res=listA[i][1]
    if res=="WA" and ans[num] == 0:
        pena[num] =  pena[num]+1
    if res=="AC" and ans[num] == 0:
        ans[num] = ans[num] + 1
        
print('%d %d' % (sum(ans), sum(pena) ))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

def pin(type=int):
    return eval("map(type,input().split())")
#1行ごとに読み込んでいる
#変数一個だけのときはカンマを入れるだけ、input()相当。ちょろい。
#sum関数などintを相手にした関数を書く時に便利なのでデフォルトをint型にする

N,M = pin() 
p=[0 for j in range(0,M)]
S=[0 for j in range(0,M)]
for j in range(0,M):
    p[j],S[j] =pin(str) #p_i,S_iにそれぞれ対応
    #print("sah")
# O(3M)...?
#print(p)
#print(p,S)
#ACした問題番号と各々の問題（後々AC下かを考えない）ペナ数を問題番号別にまとめた配列
AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]

#問題番号iと回答番号jについて,
"""
for i in range(0,N):
    for j in range(0,M):
    
        #jがiの回答である時に,WAだったらPenaltiesに1個加算
        if int(p[j])-1==i:
            if (S[j]) == 'WA':
                Penalties[int(p[j])-1] += 1
            else:#それが初めてのACならば、AC数に1を足してcontinueで次の問題i+1へ移る
                AC[int(p[j])-1] = 1
                break
            #print(AC,Penalties)
"""
#double-loop だと　TLEしてしまう O(n^2)はだめみたい

#singleloopしかないねぇ
#回答番号jに着目する
for j in range (0,M):
    if S[j] == "AC":
        if AC[int(p[j])-1]==1:
            continue
        else:
            AC[int(p[j])-1]=1
    else:#wa or something
        if AC[int(p[j])-1]==1:
            continue
        else:
            Penalties[int(p[j])-1]+=1
  # print(AC,Penalties)

for i in range(0,N-1):
    if AC[i] == 0:
        Penalties[i]=0
#print("///////")    
#print(AC,Penalties)    



#ACリスト内の1の数を数えるのは iter.countだね
print(AC.count(1),sum(Penalties))

Submission status: Wrong Answer

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(input().split())
    except:
        break;
        
N = int(listA[0][0])
M = int(listA[0][1])

ans = [0] * N
pena = [0] * N

for i in range(1, M):
    num=int(listA[i][0]) -1
    res=listA[i][1]
    if res=="WA" and ans[num] == 0:
        pena[num] =  pena[num]+1
    if res=="AC":
        ans[num] = ans[num] + 1
        
print('%d %d' % (sum(ans), sum(pena) ))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
A = [list(map(str, input().split())) for _ in range(M)]
ctr, AC, WA = 0, 0, 0
flag = False

for i in range(1, N + 1):
    flag = False
    for j in range(ctr, M):
        if int(A[j][0]) == i and A[j][1] == 'WA' and flag == False:
            ctr += 1
            WA += 1
        elif int(A[j][0]) == i and A[j][1] == 'AC' and flag == False:
            ctr += 1
            AC += 1
            flag = True
        elif int(A[j][0]) == i and flag == True:
            ctr += 1
        else:
            break
print(AC, WA)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
A = [list(map(str, input().split())) for _ in range(M)]
ctr, AC, WA = 0, 0, 0
flag = False

for i in range(1, N + 1):
    flag = False
    for j in range(ctr, M):
        if int(A[j][0]) == i and A[j][1] == 'WA' and flag == False:
            ctr += 1
            WA += 1
        elif int(A[j][0]) == i and A[j][1] == 'AC' and flag == False:
            ctr += 1
            AC += 1
            flag = True
        elif flag == True:
            ctr += 1
        else:
            break
print(AC, WA)

Submission status: Wrong Answer

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]

ans = [0] * N
pena = [0] * N

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

def pin(type=int):
    return eval("map(type,input().split())")
#1行ごとに読み込んでいる
#変数一個だけのときはカンマを入れるだけ、input()相当。ちょろい。
#sum関数などintを相手にした関数を書く時に便利なのでデフォルトをint型にする

N,M = pin() 
p=[0 for j in range(0,M-1)]
S=[0 for j in range(0,M-1)]
for j in range(0,M-1):
    p[j],S[j] =pin(str) #p_i,S_iにそれぞれ対応
# O(3M)...?

#print(p,S)
#ACした問題番号と各々の問題（後々AC下かを考えない）ペナ数を問題番号別にまとめた配列
AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]

#問題番号iと回答番号jについて,
"""
for i in range(0,N):
    for j in range(0,M):
    
        #jがiの回答である時に,WAだったらPenaltiesに1個加算
        if int(p[j])-1==i:
            if (S[j]) == 'WA':
                Penalties[int(p[j])-1] += 1
            else:#それが初めてのACならば、AC数に1を足してcontinueで次の問題i+1へ移る
                AC[int(p[j])-1] = 1
                break
            #print(AC,Penalties)
"""
#double-loop だと　TLEしてしまう O(n^2)はだめみたい

#singleloopしかないねぇ
#回答番号jに着目する
for j in range (0,M-1):
    if S[j] == "AC":
        if AC[int(p[j])-1]==1:
            continue
        else:
            AC[int(p[j])-1]=1
    else:#wa or something
        if AC[int(p[j])-1]==1:
            continue
        else:
            Penalties[int(p[j])-1]=1
    

for i in range(0,N-1):
    if AC[i] == 0:
        Penalties[i]=0
    
    

#print(AC,Penalties)

#ACリスト内の1の数を数えるのは iter.countだね
print(AC.count(1),Penalties.count(1))
""" 
for i in range(0,N):
    acnum += AC[i]
    if AC[i]==1:
        pennum += Penalties[i]
"""

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(" "))
ac = 0
wa = 0
ar = []
w = 0
N = ""
for i in range(m):
    l = input().split(" ")
    if l[0] not in ar:
        if l[0] != N:
            w = 0
            N = l[0]
        if l[1] == "WA":
            w += 1
        else:
            ac += 1
            wa += w
            w = 0
            ar.append(l[0])
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys

N, M = [int(i) for i in input().split()]
wa_dict = {}
for line in sys.stdin:
  line = line.rstrip().split()
  if len(line) == 0: break
  p = int(line[0])
  S = line[1]
  if p not in wa_dict:
    if S == "WA":
      wa_dict[p] = 1
    else:
      wa_dict[p] = 0
  elif wa_dict[p] > 0:
    if S == "WA":
      wa_dict[p] += 1
    else:
      wa_dict[p] *= -1
ac = sum([1 for i in wa_dict.values() if i <= 0])
wa = sum([abs(i) for i in wa_dict.values()])
print("{} {}".format(ac, wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(" "))
ac = 0
wa = 0
ar = []
w = 0
for i in range(m):
    l = input().split(" ")
    if l[0] not in ar:
        if l[1] == "WA":
            w += 1
        else:
            ac += 1
            wa += w
            w = 0
            ar.append(l[0])
print(ac,wa)

Submission status: Wrong Answer

Solution code:
#!python3.4.3

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

penalty = [0 for _ in range(n)]
result = [0 for _ in range(n)]

for i in range(m):
    p, s = input().split(' ')
    p = int(p)
    if s == 'AC':
        result[p-1] = 1
    elif s == 'WA' and result[p-1] != 1:
        penalty[p-1] += 1

print(sum(result), sum(penalty))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(" "))
ac = 0
wa = 0
ar = []
for i in range(m):
    l = input().split(" ")
    if l[0] not in ar:
        if l[1] == "WA":
            wa += 1
        else:
            ac += 1
            ar.append(l[0])
print(ac,wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt_penalty =0
cnt_answer =0

j =0
# print(p)
for i in range(M):
     if int(p[i][0]) == j +1:
        if p[i][1] =="AC":
            cnt_answer = cnt_answer +1
#             print("cnt_answer")
            j = j +1
        elif p[i][1] =="WA":
            cnt_penalty = cnt_penalty +1
#             print("cnt_penalty")

print(cnt_answer)
print(cnt_penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[list(input().split()) for _ in range(M)]
AC_count=0
WA_count=0
AC_flag=0
wcount=0
if M==0:
  print(0,0)
  exit()
if p[0][1]=="WA":
  wcount+=1
else:
  AC_count+=1
  AC_flag=1

for i in range(1,M):
  if p[i-1][0]!=p[i][0]:
    if AC_flag==1:
      WA_count+=wcount
    AC_flag=0
    wcount=0
  
  if p[i][1]=="WA" and AC_flag==0:
    wcount+=1
  elif p[i][1]=="AC" and AC_flag==0:
    AC_count+=1
    AC_flag=1
if AC_flag==1:
  WA_count+=wcount
print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[list(input().split()) for _ in range(M)]
AC_count=0
WA_count=0
AC_flag=0
wcount=0
if M==0:
  print(0,0)
  exit()
if p[0][1]=="WA":
  wcount+=1
else:
  AC_count+=1
  AC_flag=1

for i in range(1,M):
  if p[i-1][0]!=p[i][0]:
    if AC_flag==1:
      WA_count+=wcount
    AC_flag=0
    wcount=0
  
  if p[i][1]=="WA" and AC_flag==0:
    wcount+=1
  elif p[i][1]=="AC" and AC_flag==0:
    AC_count+=1
    AC_flag=1
if AC_flag==0:
  WA_count+=wcount
print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[list(input().split()) for _ in range(M)]
AC_count=0
WA_count=0
AC_flag=0
wcount=0
if M==0:
  print(0,0)
  exit()
if p[0][1]=="WA":
  wcount+=1
else:
  AC_count+=1
  AC_flag=1

for i in range(1,M):
  if p[i-1][0]!=p[i][0]:
    if AC_flag==1:
      WA_count+=wcount
    AC_flag=0
    wcount=0
  
  if p[i][1]=="WA" and AC_flag==0:
    wcount+=1
  elif p[i][1]=="AC" and AC_flag==0:
    AC_count+=1
    AC_flag=1
WA_count+=wcount
print(AC_count,WA_count)