# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1209086 | Boomyday | 송금 (JOI19_remittance) | Pypy 3 | 1099 ms | 72964 KiB |
from fractions import *
n = int(input())
X = [0 for _ in range(n)]
sa, sb = 0,0
for i in range(n):
a,b = map(int, input().split())
sa += a
sb += b
X[i] = a-b
if (sb == 0):
if sa == 0:
print("Yes")
else:
print("No")
exit()
ans = [0 for _ in range(n)]
val = 0
for i in range(1, n):
val += X[i]*(2**(i-1))
val += X[0]*(2**(n-1))
if (val % (2**n - 1)) != 0:
print("No")
exit()
ans[0] = val//(2**n - 1)
if (ans[0] < 0):
print("No")
exit()
for i in range(1, n):
if (ans[i-1] + X[i])%2 != 0:
print("No")
exit()
ans[i] =(ans[i-1] + X[i])//2
if (ans[i] < 0):
print("No")
exit()
print("Yes")
Compilation message (stdout)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |