結果
| 問題 |
No.693 square1001 and Permutation 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-21 20:40:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 449 bytes |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-06-30 17:40:24 |
| 合計ジャッジ時間 | 993 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)