結果

問題 No.2289 順列ソート
ユーザー dangodango
提出日時 2023-06-14 16:03:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 176 bytes
コンパイル時間 559 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 75,580 KB
最終ジャッジ日時 2023-09-05 03:49:46
合計ジャッジ時間 4,014 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,136 KB
testcase_01 AC 72 ms
70,832 KB
testcase_02 AC 72 ms
71,068 KB
testcase_03 AC 79 ms
75,520 KB
testcase_04 AC 75 ms
75,264 KB
testcase_05 AC 77 ms
75,328 KB
testcase_06 AC 78 ms
75,520 KB
testcase_07 AC 76 ms
75,372 KB
testcase_08 AC 75 ms
75,312 KB
testcase_09 AC 73 ms
75,260 KB
testcase_10 AC 72 ms
75,260 KB
testcase_11 AC 74 ms
75,432 KB
testcase_12 AC 75 ms
75,364 KB
testcase_13 AC 74 ms
75,496 KB
testcase_14 AC 74 ms
75,448 KB
testcase_15 AC 76 ms
75,420 KB
testcase_16 AC 75 ms
75,368 KB
testcase_17 AC 74 ms
75,580 KB
testcase_18 AC 75 ms
75,356 KB
testcase_19 AC 71 ms
70,964 KB
testcase_20 AC 75 ms
75,520 KB
testcase_21 AC 73 ms
71,084 KB
testcase_22 AC 73 ms
71,140 KB
testcase_23 AC 76 ms
75,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N):
	for j in range(i + 1, N):
		if P[j] == i + 1:
			P[i], P[j] = P[j], P[i]
			ans += 1
print(ans)
0