結果

問題 No.1160 Strange Bowling
ユーザー brthyyjpbrthyyjp
提出日時 2021-07-05 22:04:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 343 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 81,684 KB
最終ジャッジ日時 2023-09-14 04:16:11
合計ジャッジ時間 6,974 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 69 ms
71,048 KB
testcase_02 AC 68 ms
71,016 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 68 ms
71,056 KB
testcase_07 AC 70 ms
70,924 KB
testcase_08 AC 69 ms
70,932 KB
testcase_09 AC 68 ms
71,052 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 146 ms
81,684 KB
testcase_31 AC 121 ms
80,196 KB
testcase_32 AC 101 ms
77,328 KB
testcase_33 AC 113 ms
79,200 KB
testcase_34 AC 111 ms
78,900 KB
testcase_35 AC 136 ms
81,660 KB
testcase_36 AC 68 ms
70,988 KB
testcase_37 AC 68 ms
70,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
PA = []
for i in range(n):
    p, a = map(int, input().split())
    PA.append((p, a))
PA.reverse()

ans = 0
for i in range(n):
    p, a = PA[i]
    if i == 0:
        ans += p
        x = p
    else:
        if x+a >= p:
            ans += x+a
            x = a
        else:
            ans += p
            x = p
print(ans)
0