結果

問題 No.633 バスの運賃
ユーザー roarisroaris
提出日時 2020-12-19 20:35:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 81,596 KB
実行使用メモリ 59,656 KB
最終ジャッジ日時 2023-10-21 09:30:47
合計ジャッジ時間 1,363 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,344 KB
testcase_01 AC 43 ms
59,332 KB
testcase_02 AC 40 ms
53,344 KB
testcase_03 AC 40 ms
53,344 KB
testcase_04 AC 51 ms
59,656 KB
testcase_05 AC 40 ms
53,344 KB
testcase_06 AC 40 ms
53,344 KB
testcase_07 AC 44 ms
59,332 KB
testcase_08 AC 41 ms
53,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

n = int(input())
a = [int(input()) for _ in range(n-1)]
now = []
ans = 0

for i in range(n):
    b, c = map(int, input().split())
    
    for _ in range(b):
        ans += now.pop()
    
    for _ in range(c):
        now.append(0)

    for j in range(len(now)):
        now[j] += a[i]
    
print(ans)
0