結果
| 問題 |
No.2289 順列ソート
|
| コンテスト | |
| ユーザー |
学ぶマン
|
| 提出日時 | 2025-08-09 21:01:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 284 bytes |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 82,296 KB |
| 実行使用メモリ | 53,760 KB |
| 最終ジャッジ日時 | 2025-08-09 21:01:10 |
| 合計ジャッジ時間 | 2,052 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import sys
N = int(input())
P = list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
ans = 0
for i in range(N):
idx = P.index(i)
# 一致してなかったら移動させる
if idx != i:
P[i], P[idx] = P[idx], P[i]
ans += 1
print(ans)
学ぶマン