結果

問題 No.929 よくあるボールを移動するやつ
ユーザー stngstng
提出日時 2022-08-15 10:31:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 362 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 79,228 KB
最終ジャッジ日時 2024-04-09 22:36:11
合計ジャッジ時間 1,890 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,620 KB
testcase_01 AC 34 ms
51,940 KB
testcase_02 AC 36 ms
52,668 KB
testcase_03 AC 35 ms
52,460 KB
testcase_04 AC 38 ms
52,824 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 53 ms
72,796 KB
testcase_14 AC 53 ms
73,532 KB
testcase_15 AC 61 ms
74,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
b = [int(i) for i in input().split()]

now = 0
ans = 0
for i in range(n):
    if b[i] == 0:
        for j in range(n):
            if b[now] >= 1:
                b[now] -= 1
                b[i] = 1
                #print(now-i,"now")
                ans += abs(now-i)
                break
            else:
                now += 1
print(ans)
0