結果
問題 |
No.1425 Yet Another Cyclic Shifts Sorting
|
ユーザー |
![]() |
提出日時 | 2021-03-12 21:50:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 277 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 81,844 KB |
実行使用メモリ | 117,492 KB |
最終ジャッジ日時 | 2024-10-14 12:11:51 |
合計ジャッジ時間 | 9,456 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 28 |
ソースコード
n=int(input()) a=list(map(int,input().split())) b=[] for i in range(n): b.append((a[i],i)) b.sort() ans=0 pointer=0 if b[n-1][1]!=n-1: ans+=1 for i in range(n-2,-1,-1): if b[i][1]+1!=b[i+1][1]: if b[i+1][1]==pointer: pointer+=1 else: ans+=1 print(ans)