結果

問題 No.693 square1001 and Permutation 2
ユーザー RK PythonRK Python
提出日時 2020-06-22 15:38:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 302 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2023-09-16 19:14:26
合計ジャッジ時間 1,246 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 16 ms
7,808 KB
testcase_02 WA -
testcase_03 AC 15 ms
7,928 KB
testcase_04 WA -
testcase_05 AC 15 ms
7,752 KB
testcase_06 AC 14 ms
7,784 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 15 ms
7,836 KB
testcase_10 AC 14 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(i) for i in input().split()]
count = [0]*(N)
for a in A:
    count[a-1] += 1
tc = 0
k = -1
for i,n in enumerate(count):
    if n > 1:
        for j in range(n-1):
            j = count.index(0, k+1)
            count[j] += 1
            tc += j - i
            k = j
print(tc)
0