結果
| 問題 | No.2289 順列ソート |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2023-05-05 21:38:15 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 191 bytes |
| 記録 | |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 52,224 KB |
| 最終ジャッジ日時 | 2026-05-17 03:15:04 |
| 合計ジャッジ時間 | 6,169 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
N = int(input())
P = list(map(lambda x: int(x)-1, input().split()))
ans = 0
for i in range(N):
p = P.index(i)
if i != p:
P[i], P[p] = P[p], P[i]
ans += 1
print(ans)
norioc