結果

問題 No.904 サメトロ
ユーザー toyuzuko
提出日時 2020-04-08 21:45:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 1,000 ms
コード長 316 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 75,392 KB
最終ジャッジ日時 2024-07-19 05:45:13
合計ジャッジ時間 2,827 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = []
B = []
for _ in range(N - 1):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
S = sum(A)
T = sum(B)
res = 0
for i in range(min(S, T) + 1):
    p = max(S, T) + i
    for j in range(N - 1):
        if A[j] + B[j] > p:
            break
    else:
        res += 1
print(res)
0