結果

問題 No.904 サメトロ
ユーザー ttrttr
提出日時 2020-02-03 21:52:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 1,000 ms
コード長 348 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 67,604 KB
最終ジャッジ日時 2023-10-19 10:49:45
合計ジャッジ時間 3,322 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
59,412 KB
testcase_01 AC 49 ms
59,580 KB
testcase_02 AC 62 ms
61,616 KB
testcase_03 AC 47 ms
59,572 KB
testcase_04 AC 51 ms
61,480 KB
testcase_05 AC 40 ms
53,356 KB
testcase_06 AC 56 ms
61,480 KB
testcase_07 AC 48 ms
61,704 KB
testcase_08 AC 62 ms
61,480 KB
testcase_09 AC 38 ms
53,356 KB
testcase_10 AC 48 ms
59,572 KB
testcase_11 AC 47 ms
59,572 KB
testcase_12 AC 42 ms
59,296 KB
testcase_13 AC 48 ms
61,704 KB
testcase_14 AC 47 ms
59,572 KB
testcase_15 AC 43 ms
59,296 KB
testcase_16 AC 53 ms
61,712 KB
testcase_17 AC 40 ms
53,356 KB
testcase_18 AC 41 ms
53,356 KB
testcase_19 AC 50 ms
61,704 KB
testcase_20 AC 41 ms
53,356 KB
testcase_21 AC 50 ms
61,712 KB
testcase_22 AC 57 ms
61,460 KB
testcase_23 AC 48 ms
59,572 KB
testcase_24 AC 56 ms
61,616 KB
testcase_25 AC 39 ms
53,356 KB
testcase_26 AC 49 ms
61,636 KB
testcase_27 AC 107 ms
67,604 KB
testcase_28 AC 39 ms
53,356 KB
testcase_29 AC 39 ms
53,356 KB
testcase_30 AC 39 ms
53,356 KB
testcase_31 AC 40 ms
53,356 KB
testcase_32 AC 40 ms
53,356 KB
testcase_33 AC 38 ms
53,356 KB
testcase_34 AC 39 ms
53,356 KB
testcase_35 AC 45 ms
59,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
L = [[int(l) for l in input().split()] for _ in range(N-1)]

A = 0
B = 0
for t in L:
    A += t[0]
    B += t[1]

ans = 0
for i in range(B+1):
    j = A+i-B
    if j < 0:
        continue
    flag = True
    for t in L:
        if t[0] > B+j-t[1]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)
0