結果

問題 No.904 サメトロ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-05-03 23:37:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 179 ms / 1,000 ms
コード長 380 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 77,108 KB
最終ジャッジ日時 2023-09-15 20:33:18
合計ジャッジ時間 5,996 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
76,876 KB
testcase_01 AC 98 ms
76,424 KB
testcase_02 AC 115 ms
76,960 KB
testcase_03 AC 116 ms
76,740 KB
testcase_04 AC 114 ms
76,864 KB
testcase_05 AC 93 ms
76,336 KB
testcase_06 AC 121 ms
77,108 KB
testcase_07 AC 111 ms
76,772 KB
testcase_08 AC 142 ms
76,680 KB
testcase_09 AC 91 ms
76,284 KB
testcase_10 AC 152 ms
76,576 KB
testcase_11 AC 149 ms
76,624 KB
testcase_12 AC 115 ms
76,768 KB
testcase_13 AC 100 ms
76,676 KB
testcase_14 AC 112 ms
76,596 KB
testcase_15 AC 133 ms
76,604 KB
testcase_16 AC 151 ms
76,900 KB
testcase_17 AC 118 ms
76,764 KB
testcase_18 AC 90 ms
76,476 KB
testcase_19 AC 104 ms
76,984 KB
testcase_20 AC 100 ms
76,456 KB
testcase_21 AC 126 ms
76,920 KB
testcase_22 AC 156 ms
76,812 KB
testcase_23 AC 130 ms
76,668 KB
testcase_24 AC 108 ms
76,632 KB
testcase_25 AC 87 ms
76,516 KB
testcase_26 AC 162 ms
76,864 KB
testcase_27 AC 173 ms
76,732 KB
testcase_28 AC 87 ms
76,296 KB
testcase_29 AC 179 ms
76,692 KB
testcase_30 AC 87 ms
76,444 KB
testcase_31 AC 91 ms
76,308 KB
testcase_32 AC 88 ms
76,344 KB
testcase_33 AC 89 ms
76,176 KB
testcase_34 AC 89 ms
76,568 KB
testcase_35 AC 94 ms
76,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = [0]*n
B = [0]*n
for i in range(n-1):
    A[i+1],B[i+1] = map(int,input().split())

AS = sum(A)
BS = sum(B)

ans = 0
for a in range((n+2)*10**4):
    b = a+AS-BS
    if b < 0:
        continue
    A[0],B[0] = a,b
    sa = AS+a
    sb = BS+b
    ok = 1
    for na,nb in zip(A,B):
        if na > sb-nb or nb > sa-na:
            ok = 0
    ans += ok

print(ans)
0