We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a0f4de7 commit 358eb9bCopy full SHA for 358eb9b
1 file changed
심수연/6주차/260205.py
@@ -0,0 +1,22 @@
1
+# https://www.acmicpc.net/problem/14467
2
+
3
+import sys
4
+from collections import defaultdict
5
+input = sys.stdin.readline
6
7
+N = int(input())
8
9
+count = 0
10
11
+dict = {}
12
13
+for i in range(N):
14
+ cow, location = map(int, input().split())
15
16
+ if cow not in dict: # cow가 없을 땐
17
+ dict[cow] = location # 초기화
18
+ elif location != dict[cow]: # cow가 이미 있는데 location 이 다를 땐
19
+ count += 1 # count up
20
+ dict[cow] = location # 업데이트
21
22
+print(count)
0 commit comments