結果
| 問題 | No.693 square1001 and Permutation 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-21 20:40:16 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 449 bytes |
| 記録 | |
| コンパイル時間 | 343 ms |
| コンパイル使用メモリ | 20,952 KB |
| 実行使用メモリ | 15,484 KB |
| 最終ジャッジ日時 | 2026-03-21 01:20:24 |
| 合計ジャッジ時間 | 1,970 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 |
ソースコード
N=int(input())
num=input()
num_list=num.split()
num_list1=num.split()
num_list2=[int(i) for i in num_list1]
num_list2.sort()
cnt=0
for i in range(N):
if num_list2[i]!=i+1:
while True:
if num_list2[i]<i+1:
num_list2[i]=num_list2[i]+1
cnt+=1
elif num_list2[i]>i+1:
num_list2[i]=num_list2[i]-1
cnt+=1
else:
break
print(cnt)