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())
rec = []
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    rec.append([p,S])
N_list = AC_cnt=WA_cnt= [0 for i in range(N)]
for i in range(M):
    if rec[i][1] == "AC":
        if N_list[rec[i][0]-1] == 0:
            AC_cnt[rec[i][0]-1] = 1
            N_list[rec[i][0]-1] = 1
    if rec[i][1] == "WA":
        if N_list[rec[i][0]-1] == 0:
            WA_cnt[rec[i][0]-1] += 1
print(sum(AC_cnt), sum(WA_cnt))

Submission status: Wrong Answer

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

a = 0
p = 0
m = 0
ans = "WA"
for i in range(M):
  P, S = input().split()
  P = int(P)
  if S == "AC" and m != P:
    a += 1
    m = P
    ans = "AC"
  if S == "AC" and m == P:
    ans = "AC"
    continue
  if S == "WA" and ans == "AC":
    p += 1

print(a,p)

Submission status: Wrong Answer

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

a = 0
p = 0
m = 0
for i in range(M):
  P, S = input().split()
  P = int(P)
  if S == "AC" and m != P:
    a += 1
    m = P
  if S == "AC" and m == P:
    continue
  else:
    p += 1

print(a,p)

Submission status: Wrong Answer

Solution code:
import sys, heapq
from collections import defaultdict
from itertools import product, permutations, combinations
from bisect import bisect_left # bisect(list, value) -> index

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

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

ac_num = defaultdict(int) # number of AC : dict
wa_num = defaultdict(int) # number of WA : dict
wass = 0 # number of WA : int
for ps in pS:
    p, S = int(ps[0]), ps[1]
    # 一度問題pがACなら飛ばす
    if ac_num[p] == 1:
        continue
    else:
        if S == 'AC':
            ac_num[p] = 1
            # ACになるまでにWAになった数を記録
            wass += wa_num[p]
        elif S == 'WA':
            wa_num[p] += 1
    print(ac_num, wa_num)

print(sum(list(ac_num.values())), wass)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
rec = []
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    rec.append([p,S,True])
keep = []
AC_cnt=WA_cnt=0
N_list = [0 for i in range(N)]
for i in range(M):
    if rec[i][1] == "AC":
        if N_list[rec[i][0]-1] == 0:
            AC_cnt += 1
            N_list[rec[i][0]-1] = 1
    if rec[i][1] == "WA":
        if N_list[rec[i][0]-1] == 0:
            WA_cnt += 1
print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

Solution code:
import sys, heapq
from collections import defaultdict
from itertools import product, permutations, combinations
from bisect import bisect_left # bisect(list, value) -> index

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

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

was = defaultdict(int) # number of WA
chk = defaultdict(int) # chkflg
for ps in pS:
    p, S = int(ps[0]), ps[1]
    if chk[p] == 1:
        continue
    else:
        if S == 'AC':
            chk[p] = 1
        else:
            was[p] += 1

wass = [num for i, num in enumerate(was.values()) if chk[i+1]==1]
print(sum(list(chk.values())), sum(wass))

Submission status: Wrong Answer

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

# [correct, penalty]
count = [0] * 2
now = 0

for i in range(m):
    if now != p_s[i][0]:
        now = p_s[i][0]
        check_ac = False

    if p_s[i][1] == "WA":
        if not check_ac:
            count[1] += 1
    elif p_s[i][1] == "AC":
        if not check_ac:
            count[0] += 1
            check_ac = True

print(*count)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)

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

ans = 0
penalty = 0

for i in range(1, N + 1):
    ans += d[(i, 'AC')]
    penalty += d[(i, 'WA')]
    # print(i, ans, penalty)

print('{} {}'.format(ans, penalty))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)

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

ans = 0
penalty = 0

for i in range(1, N + 1):
    ans += d[(i, 'AC')]
    penalty += d[(i, 'WA')]
    print(i, ans, penalty)

print('{} {}'.format(ans, penalty))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)

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

ans = 0
penalty = 0

for i in range(1, N + 1):
    ans += d[(i, 'AC')]
    penalty += d[(i, 'WA')]

print('{} {}'.format(ans, penalty))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)

for i in range(M):
    p, S = input().split()
    p = int(p)
    if d[(p, 'AC')] > 0:
        pass
    elif S == 'AC':
        d[(p, 'AC')] += 1
        # print(p, 'AC')
    else:
        d[(p, 'WA')] += 1

ans = 0
penalty = 0

for i in range(1, N + 1):
    ans += d[(i, 'AC')]
    penalty += d[(i, 'WA')]

print('{} {}'.format(ans, penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
rec = []
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    rec.append([p,S,True])
keep = []
AC_cnt=WA_cnt=0
for i in range(M):
    flag = False
    if rec[i][1] == "AC":
        for j in keep:
            if j==rec[i][0]:
                flag = True
                break
        if flag == False:
            AC_cnt += 1
            keep.append(rec[i][0])
    if rec[i][1] == "WA":
        for j in keep:
            if j==rec[i][0]:
                flag = True
                break
        if flag == False:
            WA_cnt += 1
print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)

for i in range(M):
    p, S = input().split()
    p = int(p)
    if d[(p, 'AC')] > 0:
        pass
    elif S == 'AC':
        d[(p, 'AC')] += 1
        # print(p, 'AC')
    else:
        d[(p, 'WA')] += 1

ans = 0
penalty = 0

for i in range(N):
    ans += d[(i, 'AC')]
    penalty += d[(i, 'WA')]

print('{} {}'.format(ans, penalty))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
plist=[]
slist=[]
isAc_list = [False for _ in range(n+1)]
penalty_list = [0 for _ in range(n+1)]
for i in range(m):
  inputs = input().split()
  plist.append(int(inputs[0]))
  slist.append(inputs[1])

correct = 0
penalty = 0
for problem,result in zip(plist,slist):
  if isAc_list[problem]:
    break
  elif result == 'AC':
    isAc_list[problem] = True
    correct+=1
    penalty+=penalty_list[problem]
  else:
    penalty_list[problem]+=1
print(correct,penalty)

Submission status: Wrong Answer

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

ps = []
for i in range(m):
    ps.append(list(input().split()))
    ps[i][0] = int(ps[i][0])

cnt_correct = 0
cnt_penalty = 0
cnt_penalty_buf = 0

juge = [1]*n

for i in range(m):
    if ps[i][1] == "AC" and juge[ps[i][0] - 1] == 1 :
        cnt_correct += 1
        cnt_penalty +=cnt_penalty_buf
        juge[ps[i][0] - 1] = 0
        cnt_penalty_buf = 0

    if ps[i][1] == "WA" and juge[ps[i][0] - 1] == 1:
        cnt_penalty_buf += 1

print(cnt_correct, cnt_penalty)

Submission status: Wrong Answer

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

ps = []
for i in range(m):
    ps.append(list(input().split()))
    ps[i][0] = int(ps[i][0])

cnt_correct = 0
cnt_penalty = 0

juge = [1]*n

for i in range(m):
    if ps[i][1] == "AC" and juge[ps[i][0] - 1] == 1 :
        cnt_correct += 1
        juge[ps[i][0] - 1] = 0

    if ps[i][1] == "WA" and juge[ps[i][0] - 1] == 1:
        cnt_penalty += 1

print(cnt_correct, cnt_penalty)

Submission status: Wrong Answer

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

ps = []
for i in range(m):
    ps.append(list(input().split()))
    ps[i][0] = int(ps[i][0]) 

cnt_correct = 0
cnt_penalty = 0

flag = None
for i in range(m):
    if ps[i][1] == "AC" and ps[i][0] != flag:
        cnt_correct += 1
        flag = ps[i][0]

    if ps[i][1] == "WA" and ps[i][0] != flag:
        cnt_penalty += 1

print(cnt_correct, cnt_penalty)

Submission status: Wrong Answer

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

ps = []
for i in range(m):
    ps.append(list(input().split()))
    ps[i][0] = int(ps[i][0]) 

cnt_correct = 0
cnt_penalty = 0

flag = 0
for i in range(m):
    if ps[i][1] == "AC" and ps[i][0] != flag:
        cnt_correct += 1
        flag = ps[i][0]

    if ps[i][1] == "WA" and ps[i][0] != flag:
        cnt_penalty += 1

print(cnt_correct, cnt_penalty)

Submission status: Wrong Answer

Solution code:
import sys

N, M = input().split(' ')

cnt_map = {}
cnt_ac = 0
cnt_wa = 0
current_p = 0
cnt_dict = {'AC': 0, 'WA': 0}
while True:
  try:
    p, s = input().split(' ')
    
    if p not in cnt_map:
      if cnt_dict['AC'] > 0:
        cnt_ac += cnt_dict['AC']
        cnt_wa += cnt_dict['WA']
      current_p = p
      
    cnt_dict = cnt_map.setdefault(p, {'AC': 0, 'WA': 0})
    if cnt_dict['AC'] > 0:
      continue
      
    cnt_dict[s] += 1
    
  except EOFError:
    if cnt_dict['AC'] > 0:
      cnt_ac += cnt_dict['AC']
      cnt_wa += cnt_dict['WA']
    break
    
print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

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

answered = [False]*N
n_ac = 0
n_wa = 0

for _ in range(M):
  p, s = input().split()
  p = int(p)
  p -= 1
  if not answered[p]:
    if s == 'WA':
      n_wa += 1
    else:
      answered[p] = True
      n_ac += 1

print(n_ac, n_wa)

Submission status: Wrong Answer

Solution code:
from functools import reduce
 
# input
N, M = map(int, input().split())
P = [0]*M
S = [0]*M

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

# process
ac = [0]*N
wa = [0]*N

for i in range(M):
    if S[i] == "AC":
        ac[P[i]] = 1
    else:
        if ac[P[i]] == 0:
            wa[P[i]] += 1

# outputz
print("{} {}".format(ac.count(1), reduce(lambda x, y: x+y, wa)))

Submission status: Wrong Answer

Solution code:
import sys

N, M = input().split(' ')

current_p = 1
cnt_wa = 0
cnt_ac = 0
tmp_wa = 0
ac_already = False
while True:
  try:
    p, S = input().split(' ')
    if p == current_p:
      if not ac_already:
        if S == 'WA':
          tmp_wa += 1
        else:
          cnt_ac += 1
          ac_already = True
          cnt_wa += tmp_wa
    else:
      current_p = p
      ac_already = False
      tmp_wa = 0
      if S == 'WA':
        tmp_wa += 1
      else:
        cnt_ac += 1
        ac_already = True
        cnt_wa += tmp_wa
  except EOFError:
    break
    
print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

Solution code:
import sys

N, M = input().split(' ')

current_p = 1
cnt_wa = 0
cnt_ac = 0
ac_already = False
while True:
  try:
    p, S = input().split(' ')
#    print("current_p:{}".format(current_p))
    if p == current_p:
      if not ac_already:
        if S == 'WA':
          cnt_wa += 1
        else:
          cnt_ac += 1
          ac_already = True
    else:
      current_p = p
      ac_already = False
      if S == 'WA':
        cnt_wa += 1
      else:
        cnt_ac += 1
        ac_already = True
  except EOFError:
    break
    
print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

Solution code:
import sys, heapq
from collections import defaultdict
from itertools import product, permutations, combinations
from bisect import bisect_left # bisect(list, value) -> index

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

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

was = defaultdict(int) # number of WA
chk = defaultdict(int) # chkflg
for ps in pS:
    p, S = int(ps[0]), ps[1]
    if chk[p] == 1:
        continue
    else:
        if S == 'AC':
            chk[p] = 1
        else:
            was[p] += 1

print(sum(list(chk.values())), sum(list(was.values())))

Submission status: Wrong Answer

Solution code:
num_of_probs, num_of_submission = [ int(i) for i in input().split(" ") ]

solution_table = {}

for i in range(0, num_of_submission):
  prob, result = [ i for i in input().split(" ") ]

  if solution_table.get(int(prob)) == None:
    solution_table[int(prob)] = {"WA": 0, "AC": 0}

  if result == "WA":
    if solution_table[int(prob)]["AC"] == 0:
      solution_table[int(prob)]["WA"] += 1
  else:
    if solution_table[int(prob)]["AC"] == 0:
      solution_table[int(prob)]["AC"] += 1

total_ac = 0
total_wa = 0
for value in solution_table.values():
  total_wa += value['WA']
  total_ac += value['AC']

print( total_ac, total_wa )

Submission status: Wrong Answer

Solution code:
num_of_probs, num_of_submission = [ int(i) for i in input().split(" ") ]

solution_table = {}

for i in range(0, num_of_submission):
  prob, result = [ i for i in input().split(" ") ]

  if solution_table.get(int(prob)) == None:
    solution_table[int(prob)] = {"WA": 0, "AC": 0}

  if result == "WA":
    if solution_table[int(prob)]["AC"] == 0:
      solution_table[int(prob)]["WA"] += 1
  else:
    solution_table[int(prob)]["AC"] += 1

total_wa = 0
for value in solution_table.values():
  total_wa += value['WA']

print( total_wa )

Submission status: Wrong Answer

Solution code:
num_of_probs, num_of_submission = [ int(i) for i in input().split(" ") ]

solution_table = {}

for i in range(0, num_of_submission):
  prob, result = [ i for i in input().split(" ") ]

  if solution_table.get(int(prob)) == None:
    solution_table[int(prob)] = {"WA": 0, "AC": 0}

  if result == "WA":
    if solution_table[int(prob)]["AC"] == 0:
      solution_table[int(prob)]["WA"] += 1
  else:
    solution_table[int(prob)]["AC"] += 1
  
  print(solution_table)

total_wa = 0
for value in solution_table.values():
  total_wa += value['WA']

print( total_wa )

Submission status: Wrong Answer

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

if M <= 0:
    print("0 0")
    exit(0)

exactly_answers = 0
penarty_answers = 0
ACed = [0] * N
for i in range(M):
    p,s = input().split()
    p = int(p)

    if 1 == ACed[p - 1]:
        continue

    if s == "AC":
        exactly_answers += 1
        ACed[p - 1] = 1

    elif s == "WA":
        penarty_answers += 1

print("{0} {1}".format(exactly_answers, penarty_answers))

Submission status: Wrong Answer

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

if M <= 0:
    print("0 0")
    exit(0)

exactly_answers = 0
penarty_answers = 0
temp_memory = 0

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

    if p == temp_memory:
        continue

    if s == "AC":
        exactly_answers += 1
        temp_memory = p

    elif s == "WA":
        penarty_answers += 1

print("{0} {1}".format(exactly_answers, penarty_answers))

Submission status: Wrong Answer

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

if M <= 0:
    print("0 0")
    exit(0)

exactly_answers = 0
penarty_answers = 0

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

    if p in ACed:
        continue

    if s == "AC":
        exactly_answers += 1
        ACed.append(p)

    elif s == "WA":
        penarty_answers += 1

print("{0} {1}".format(exactly_answers, penarty_answers))

Submission status: Wrong Answer

Solution code:
def solve(n, m, PS):
    prev = 0
    wa_count = 0
    ac = False
    scores = [0, 0]
    for p, s in PS:
        if p != prev:
            wa_count = 0
            ac = False
        if ac:
            continue
        if s == 'AC':
            ac = True
            scores[0] += 1
            scores[1] += wa_count
        if s == 'WA':
            wa_count += 1
        prev = p
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])

Submission status: Wrong Answer

Solution code:
def solve(n, m, PS):
    wa_count = 0
    prev = 0
    ac = False
    scores = [0, 0]
    for p, s in PS:
        if p != prev:
            wa_count = 0
            ac = False
        if s == 'AC' and not ac:
            ac = True
            scores[0] += 1
            scores[1] += wa_count
        else:
            wa_count += 1
        prev = p
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])

Submission status: Wrong Answer

Solution code:
def solve(n, m, PS):
    d = {}
    scores = [0, 0]
    for p, s in PS:
        if p not in d or d[p] == 'WA':
            scores[0 if s == 'AC' else 1] += 1
            d[p] = s
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])

Submission status: Wrong Answer

Solution code:
def solve(n, m, PS):
    d = {}
    scores = [0, 0]
    for p, s in PS:
        if not p in d:
            d[p] = ''
        if d[p] != 'WA':
            scores[0 if s == 'AC' else 1] += 1
            d[p] = s
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])

Submission status: Wrong Answer

Solution code:
def solve(n, m, PS):
    d = {}
    scores = [0, 0]
    for p, s in PS:
        if not p in d:
            d[p] = s
        if d[p] == 'WA':
            scores[0 if s == 'AC' else 1] += 1
            d[p] = s
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])

Submission status: Wrong Answer

Solution code:
import numpy as np

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

AC = np.array([0]*N) # 正解を入れる箱
WA = np.array([0]*N) # 不正解を入れる箱

for _ in range(M):
    p, S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA": # まだ「正解が出てない & 不正解」
        WA[int(p)-1] += 1              # なら不正解の箱に＋１
    else:
        AC[int(p)-1] = 1               # それ以外は正解の箱に１
    
print(sum(AC), sum(WA))

Submission status: Wrong Answer

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

wa_counter = [ 0 for i in range(N)]
ac_flag = [ 0 for i in range(N)]

for i in range(M):
  P_num, outcome = map(str, input().split())
  if ac_flag[int(P_num)-1] == 0:
    if outcome == "AC":
      ac_flag[int(P_num)-1] = 1
    else:
      wa_counter[int(P_num)-1] += 1
  else:
    pass
    
print(sum(ac_flag), sum(wa_counter))

Submission status: Wrong Answer

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

ac_counter = 0
wa_counter = 0

ac_flag = [ 0 for i in range(N)]

for i in range(M):
  P_num, outcome = map(str, input().split())
  if ac_flag[int(P_num)-1] == 0:
    if outcome == "AC":
      ac_counter += 1
      ac_flag[int(P_num)-1] = 1
    else:
      wa_counter += 1
  else:
    pass
    

print(ac_counter, wa_counter)

Submission status: Wrong Answer

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

ac_counter = 0
wa_counter = 0

ac_flag = [ 0 for i in range(N)]

for i in range(M):
  P_num, outcome = map(str, input().split())
  if ac_flag[int(P_num)-1] == 0:
    if outcome == "WA":
      wa_counter += 1
    else:
      ac_counter += 1
      ac_flag[int(P_num)-1] = 1
  else:
    pass

print(ac_counter, wa_counter)

Submission status: Wrong Answer

Solution code:
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])


def get_next_by_types(*value_types, delim=" "):
    return tuple(
        [t(x) for t, x in zip(value_types, input().rstrip("\n").split(delim))])


def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0

    from collections import defaultdict
    cache = defaultdict(int)
    ac_count = 0
    wa_count = 0
    wa = 0
    for i in range(m):

        p, result = get_next_by_types(int, str)

        if cache[p] == 0:
            if result == 'AC':

                cache[p] = 1
                ac_count += 1
                wa_count += wa
                wa = 0
            else:
                wa += 1
    print(ac_count, wa_count)


if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())

Submission status: Wrong Answer

Solution code:
def run():
  N, M = map(int, input().split())
  s_li = ['WA']*(N+1)
  num_p = 0
  for m in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
      if s_li[p] == 'WA':
        num_p += 1
    else:
      s_li[p] = 'AC'
  print(s_li.count('AC'), num_p)

if __name__ == '__main__':
  run()

Submission status: Wrong Answer

Solution code:
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def get_next_by_types(*value_types,delim=" "):
    return tuple([t(x) for t, x in zip(value_types,input().rstrip("\n").split(delim))])

def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0
    
    ac_found = False
    wa = 0
    prev_p = -1
    for i in range(m):
        
        p, result = get_next_by_types(int ,str)
        if p != prev_p:
            prev_p = p
            ac_found = False
            wa = 0
        if not ac_found:
            if result == 'AC':
                ac_found = True
                ac_count += 1
                wa_count += wa
            else:
                wa += 1
    print(ac_count, wa_count)
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())

Submission status: Wrong Answer

Solution code:
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def get_next_by_types(*value_types,delim=" "):
    return tuple([t(x) for t, x in zip(value_types,input().rstrip("\n").split(delim))])

def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0
    
    ac_found = False
    wa = 0
    prev_p = -1
    for i in range(m):
        
        p, result = get_next_by_types(int ,str)
        if p != prev_p:
            prev_p = p
            if ac_found:
                ac_count += 1
                wa_count += wa
            ac_found = False
            wa = 0
        if not ac_found:
            if result == 'AC':
                ac_found = True
            else:
                wa += 1
    if ac_found:
        ac_count += 1
        wa_count += wa
    print(ac_count, wa_count)
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())

Submission status: Wrong Answer

Solution code:
def main():
    n,m = map(int, input().split())
    s = [list(input().split()) for i in range(m)]

    ac_list = []
    correct = 0
    penalty = 0

    for i,k in enumerate(s):
        if k[1] == 'AC' and k[0] not in ac_list:
            ac_list.append(k[0])
            correct += 1
        elif k[1] == 'WA' and k[0] not in ac_list:
            penalty += 1
        else:
            continue

    print('{} {}'.format(correct,penalty))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = list(map(int, input().split()))
a = [list(map(str, input().split())) for i in range(n[1])]

wa = 0
ac = 0
num = []

for i in range(n[1]):
  ans = a[i]
  if ans[0] in num:
    pass
  elif ans[1] == 'WA':
    wa += 1
  elif ans[1] == 'AC':
    ac += 1
    num.append(ans[0])

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n = list(map(int, input().split()))
a = [list(map(str, input().split())) for i in range(n[1])]

wa = 0
ac = 0
num = 0

for i in range(n[1]):
  ans = a[i]
  if ans[0] == num:
    pass
  elif ans[1] == 'WA':
    wa += 1
  elif ans[1] == 'AC':
    ac += 1
    num = ans[0]

print(ac, wa)

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()]
s = [input().split() for i in range(a[1])]
if a[1]==0:
    print(0,0) 
else:
    wa=0
    ac=0
    ac_count=[]
    wa_count=[]
    num=int(s[0][0])
    for i in range(len(s)):
        if int(s[i][0])==num:
            if s[i][1]=="AC":
                ac=1
            if ac==0:
                wa+=1
            if i==len(s)-1 and ac==1:
                ac_count.append(ac)
                wa_count.append(wa)
        else:
            if ac==1:
                ac_count.append(ac)
                wa_count.append(wa)
            ac=0
            wa=0
            num=int(s[i][0])
            if s[i][1]=="AC":
                ac=1
            if  ac==0:
                wa+=1
            if i==len(s)-1 and ac==1:
                ac_count.append(ac)
                wa_count.append(wa)
    print(sum(ac_count),sum(wa_count))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
P_S = [input().split() for _ in range(M)]
ac = [0]*(N)
wa = [0]*(N)
for i in range(M):
    no = int(P_S[i][0])
    result = P_S[i][1]
    if ac[no-1] ==0 and result == "AC":
        ac[no-1] =1    
    elif ac[no-1] ==0 and result =="WA":
        wa[no-1] += 1
for i in range(N):
    if ac[i] != 1:
        ac[i] = 0
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
pena = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
print(c_wa)
for k in range(N):
    if ans[k] == 1:
        pena += c_wa[k]
    

            
print(sum(ans), pena)

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()]
s = [input().split() for i in range(a[1])]
if a[1]==0:
    print(0,0)
else:
    num=int(s[0][0])
    ac=[]
    wa=[]
    ac_count=0
    wa_count=0
    for i in range(a[1]):
        if int(s[i][0])==num:
            if s[i][1]=='AC':
                ac_count=1
            else:
                if ac_count==0:
                    wa_count+=1
            if i==a[1]-1:
                if ac_count==1:
                    ac.append(ac_count)
                    wa.append(wa_count)
        else:
            if ac_count==1:
                ac.append(ac_count)
                wa.append(wa_count)
            ac_count=0
            wa_count=0
            num=int(s[i][0])
            if int(s[i][0])==num:
                if s[i][1]=='AC':
                    ac_count=1
                else:
                    if ac_count==0:
                        wa_count+=1
                if i==a[1]-1:
                    if ac_count==1:
                        ac.append(ac_count)
                        wa.append(wa_count)
    print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
pena = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
for k in range(M):
    if ans[p[k] - 1] == 1:
        pena += c_wa[p[k] - 1]
    

            
print(sum(ans), pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
P_S = [input().split() for _ in range(M)]
ac = [0]*(N+1)
wa = [0]*(N+1)
for i in range(M):
    no = int(P_S[i][0])
    result = P_S[i][1]
    if ac[no] ==0 and result == "AC":
        ac[no] =1    
    elif ac[no] ==0 and result =="WA":
        wa[no] += 1
for i in range(N+1):
    if ac[i] != 1:
        ac[i] = 0
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
c_sum = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
    
    for i in range(N):
        if ans[p[j]-1] == 1:
            c_sum += c_wa[p[j]-1]
        
            
print(sum(ans), c_sum)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 0
Q = [0] * N
wrong = [0] * N
for i in range(M):
  p, S = map(str, input().split())
  p = int(p) - 1
  if Q[p] == 0 and S == "AC":
    ans += wrong[p]
    Q[p] = 1
  elif S == "WA":
    wrong[p] += 1
print(ans)