結果
問題 |
No.633 バスの運賃
|
ユーザー |
![]() |
提出日時 | 2020-02-05 07:32:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 214 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 60,544 KB |
最終ジャッジ日時 | 2024-09-21 23:38:34 |
合計ジャッジ時間 | 1,338 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 6 |
ソースコード
from itertools import accumulate from collections import defaultdict def main(): n = int(input()) a = [0] + [int(input()) for _ in range(n - 1)] sum_a = list(accumulate(a)) d = defaultdict(int) ans = 0 for i in range(n): b, c = map(int, input().split()) for j, k in d.items(): tmp = sum_a[i] - sum_a[j] if k == 0: continue if b > k: print(tmp * k) ans += tmp * k d[j] = 0 b -= k else: ans += tmp * b d[j] -= b break d[i] += c print(ans) if __name__ == "__main__": main()