結果
| 問題 |
No.929 よくあるボールを移動するやつ
|
| コンテスト | |
| ユーザー |
学ぶマン
|
| 提出日時 | 2025-09-11 23:00:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 332 bytes |
| コンパイル時間 | 2,803 ms |
| コンパイル使用メモリ | 81,860 KB |
| 実行使用メモリ | 96,384 KB |
| 最終ジャッジ日時 | 2025-09-11 23:01:00 |
| 合計ジャッジ時間 | 5,218 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
ソースコード
N = int(input())
B = list(map(int, input().split()))
balls_index = []
vacant_index = []
for i in range(N):
b = B[i]
if b == 0:
vacant_index.append(i)
else:
for _ in range(b - 1):
balls_index.append(i)
ans = 0
for x, y in zip(balls_index, vacant_index):
ans += abs(x - y)
print(ans)
学ぶマン