Skip to content

Commit 6779105

Browse files
authored
dict
1 parent 1c336ae commit 6779105

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

구름_Dead or Arrive.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
n = int(input())
5+
car = {}
6+
res = [0 for i in range(1000)]
7+
8+
for i in range(1,n+1):
9+
v,w = map(int,input().split())
10+
if v not in car:
11+
car[v] = w
12+
res[v-1] = i
13+
else :
14+
if car[v] <= w :
15+
car[v] = w
16+
res[v-1] = i
17+
print(sum(res))

0 commit comments

Comments
 (0)