結果
問題 | No.2289 順列ソート |
ユーザー |
|
提出日時 | 2023-11-16 19:34:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 215 bytes |
コンパイル時間 | 238 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 51,968 KB |
最終ジャッジ日時 | 2024-09-26 05:14:24 |
合計ジャッジ時間 | 2,369 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
N = int(input()) P = list(map(int, input().split())) Q = sorted(P) ans = 0 for i in range(1, N + 1): j = P.index(i) if j != i - 1: ans += 1 P[j], P[i - 1] = P[i - 1], P[j] print(ans)