結果

問題 No.929 よくあるボールを移動するやつ
ユーザー TS_KAsTS_KAs
提出日時 2019-11-23 00:43:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 320 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 92,568 KB
最終ジャッジ日時 2024-04-19 14:08:27
合計ジャッジ時間 1,574 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
51,712 KB
testcase_01 AC 32 ms
51,968 KB
testcase_02 AC 31 ms
51,840 KB
testcase_03 AC 31 ms
51,712 KB
testcase_04 AC 32 ms
51,712 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 60 ms
90,752 KB
testcase_14 AC 62 ms
90,496 KB
testcase_15 AC 63 ms
91,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
B = list(map(int, input().split()))
L = [[] for _ in range(max(B)+1)]
for i in range(N):
    L[B[i]].append(i)
ans = 0
for i in range(2, len(L)):
    if len(L[i]) > 0:
        for j in L[i]:
            for _ in range(i-1):
                tmp = L[0].pop()
                ans += abs(tmp - j)
print(ans)
0