結果
問題 |
No.929 よくあるボールを移動するやつ
|
ユーザー |
![]() |
提出日時 | 2020-03-29 10:26:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 121 ms / 2,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 450 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 14,916 KB |
最終ジャッジ日時 | 2025-01-02 13:12:43 |
合計ジャッジ時間 | 2,650 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 |
ソースコード
# coding: utf-8 # Your code here! N=int(input()) B=list(map(int,input().split())) empty=[] rem=[] ans=0 for i in range(len(B)): if B[i]==0: if len(rem)==0: empty.append(i) else: ans+=(i-rem.pop(-1)) else: while B[i]>1 and empty: ans+=(i-empty.pop(-1)) B[i]-=1 for j in range(B[i]-1): rem.append(i) print(ans)