-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathABC343_D.py
More file actions
73 lines (73 loc) · 1.58 KB
/
ABC343_D.py
File metadata and controls
73 lines (73 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
###########################################
#titia
import sys
input = sys.stdin.readline
from collections import Counter
N,T=map(int,input().split())
SCORE=[0]*N
C=Counter(SCORE)
NOW=1
for i in range(T):
a,b=map(int,input().split())
a-=1
k=SCORE[a]
C[k]-=1
if C[k]==0:
NOW-=1
SCORE[a]+=b
if C[SCORE[a]]==0:
NOW+=1
C[SCORE[a]]+=1
print(NOW)
###########################################
###########################################
###########################################
###########################################
###########################################
#AC
from collections import defaultdict,deque,Counter
N,T=map(int,input().split())
A=[0]*N
C=Counter(A)
ct=1
for i in range(T):
a,b=map(int,input().split())
v=A[a-1]#value
A[a-1]+=b
C[v+b]+=1
if C[v+b]==1:
ct+=1
C[v]-=1
if C[v]==0:
ct-=1
print(ct)
###########################################
#TLE19
from collections import defaultdict,deque,Counter
N,T=map(int,input().split())
A=[0]*N
for i in range(T):
a,b=map(int,input().split())
A[a-1]+=b
C=Counter(A)
print(len(list(C)))
###########################################
#TLE19
from collections import defaultdict,deque,Counter
cnt = defaultdict(int)
N,T=map(int,input().split())
for j in range(N):
cnt[j+1]+=0
for i in range(T):
a,b=map(int,input().split())
cnt[a]+=b
print(len(set(cnt.values())))
###########################################
#TLE19
N,T=map(int,input().split())
S=[0]*N
for i in range(T):
a,b=map(int,input().split())
S[a-1]+=b
print(len(set(S)))
###########################################