結果

問題 No.904 サメトロ
ユーザー brthyyjpbrthyyjp
提出日時 2020-04-24 10:45:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 347 bytes
コンパイル時間 687 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 75,416 KB
最終ジャッジ日時 2024-04-23 02:24:37
合計ジャッジ時間 3,791 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
61,188 KB
testcase_01 AC 46 ms
61,804 KB
testcase_02 AC 59 ms
62,928 KB
testcase_03 AC 48 ms
60,840 KB
testcase_04 AC 47 ms
62,580 KB
testcase_05 AC 38 ms
52,860 KB
testcase_06 AC 52 ms
63,996 KB
testcase_07 AC 46 ms
62,592 KB
testcase_08 AC 57 ms
66,284 KB
testcase_09 AC 37 ms
53,536 KB
testcase_10 AC 48 ms
62,472 KB
testcase_11 AC 46 ms
61,276 KB
testcase_12 AC 40 ms
58,160 KB
testcase_13 AC 46 ms
61,952 KB
testcase_14 AC 46 ms
60,452 KB
testcase_15 AC 40 ms
58,516 KB
testcase_16 AC 51 ms
63,096 KB
testcase_17 AC 38 ms
53,036 KB
testcase_18 AC 37 ms
53,108 KB
testcase_19 AC 46 ms
61,276 KB
testcase_20 AC 37 ms
53,760 KB
testcase_21 AC 50 ms
63,456 KB
testcase_22 AC 54 ms
64,748 KB
testcase_23 AC 47 ms
61,696 KB
testcase_24 AC 51 ms
61,564 KB
testcase_25 AC 37 ms
51,884 KB
testcase_26 AC 49 ms
62,004 KB
testcase_27 AC 86 ms
75,416 KB
testcase_28 AC 37 ms
52,068 KB
testcase_29 AC 37 ms
52,748 KB
testcase_30 AC 38 ms
53,352 KB
testcase_31 AC 37 ms
52,340 KB
testcase_32 AC 36 ms
52,536 KB
testcase_33 AC 36 ms
52,920 KB
testcase_34 AC 37 ms
53,424 KB
testcase_35 AC 44 ms
60,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = [0]*(n-1)
B = [0]*(n-1)

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

Sa = sum(A)
Sb = sum(B)

ans = 0
for a in range(Sb+1):
    b = a + Sa - Sb
    if b < 0:
        continue
    for i in range(n-1):
        if A[i] > b + Sb - B[i]:
            break
    else:
        ans += 1
print(ans)
0