結果
問題 | No.1604 Swap Sort:ONE |
ユーザー |
![]() |
提出日時 | 2021-07-16 22:02:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 71 ms / 2,000 ms |
コード長 | 342 bytes |
コンパイル時間 | 149 ms |
コンパイル使用メモリ | 82,164 KB |
実行使用メモリ | 61,312 KB |
最終ジャッジ日時 | 2024-07-06 09:13:23 |
合計ジャッジ時間 | 2,614 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import sysinput = sys.stdin.readlineN=int(input())P=list(map(int,input().split()))for i in range(N):P[i]-=1IND=[-1]*Nfor i in range(N):IND[P[i]]=iANS=0for i in range(N):x=IND.index(i)while x>i:IND[x],IND[x-1]=IND[x-1],IND[x]x-=1ANS+=1#print(P)#print(x,ANS)print(ANS)