結果
問題 | No.929 よくあるボールを移動するやつ |
ユーザー |
|
提出日時 | 2024-11-13 18:12:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 1,931 ms |
コンパイル使用メモリ | 81,968 KB |
実行使用メモリ | 86,800 KB |
最終ジャッジ日時 | 2024-11-13 18:12:10 |
合計ジャッジ時間 | 2,731 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 |
ソースコード
N = int(input())B = list(map(int,input().split()))ans = 0L = []for i in range(N):if B[i]==0:L.append(i)elif B[i]>1:d = B[i]-1while d>0 and L:j = L.pop()B[j] = 1ans += i-jd -= 1if d>0:B[i+1] += dans += dprint(ans)