Baekjoon
백준 14467 소가 길을 건너간 이유 1
Tcoding
2023. 3. 19. 00:16
728x90
728x90
https://www.acmicpc.net/problem/14467
14467번: 소가 길을 건너간 이유 1
3번 소는 위치 1, 0, 1에서 관찰되었으므로 길을 최소 두 번 건넜음을 확인할 수 있다. 4번 소도 길을 한 번 건넜으며, 나머지 소는 길을 건넌 기록이 확인되지 않는다.
www.acmicpc.net
코드
더보기
n = int(input())
arr = {}
ans = 0
for i in range(n):
a, b = map(int, input().split())
if a not in arr:
arr[a] = b
else:
if arr[a] != b:
arr[a] = b
ans += 1
print(ans)
728x90
300x250