結果

問題 No.2289 順列ソート
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-07-25 06:07:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 82,788 KB
実行使用メモリ 62,404 KB
最終ジャッジ日時 2024-04-09 23:43:42
合計ジャッジ時間 2,428 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,936 KB
testcase_01 AC 44 ms
56,256 KB
testcase_02 AC 42 ms
55,988 KB
testcase_03 AC 49 ms
62,204 KB
testcase_04 AC 43 ms
57,276 KB
testcase_05 AC 46 ms
62,192 KB
testcase_06 AC 42 ms
55,892 KB
testcase_07 AC 46 ms
62,248 KB
testcase_08 AC 44 ms
61,924 KB
testcase_09 AC 42 ms
56,436 KB
testcase_10 AC 44 ms
62,184 KB
testcase_11 AC 45 ms
61,100 KB
testcase_12 AC 42 ms
56,292 KB
testcase_13 AC 41 ms
55,712 KB
testcase_14 AC 41 ms
55,420 KB
testcase_15 AC 45 ms
61,452 KB
testcase_16 AC 46 ms
61,316 KB
testcase_17 AC 46 ms
61,836 KB
testcase_18 AC 44 ms
61,712 KB
testcase_19 AC 42 ms
56,556 KB
testcase_20 AC 44 ms
61,512 KB
testcase_21 AC 41 ms
56,620 KB
testcase_22 AC 41 ms
55,812 KB
testcase_23 AC 44 ms
62,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

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

    
0