結果
| 問題 |
No.1425 Yet Another Cyclic Shifts Sorting
|
| コンテスト | |
| ユーザー |
yuusanlondon
|
| 提出日時 | 2021-03-12 22:44:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 343 bytes |
| コンパイル時間 | 367 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 117,332 KB |
| 最終ジャッジ日時 | 2024-10-14 13:18:55 |
| 合計ジャッジ時間 | 9,603 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 WA * 7 |
ソースコード
n=int(input())
a=list(map(int,input().split()))
c=[]
for i in range(n):
c.append((a[i],i))
c.sort()
b=[0]*n
for i in range(n):
b[c[i][1]]=i
ans=0
pointer=0
if b[n-1]!=n-1:
ans+=1
for i in range(n-2,-1,-1):
if pointer>=i:
break
if b[i]+1!=b[i+1]:
if b[i+1]==pointer:
pointer+=1
else:
ans+=1
print(min(2,ans))
yuusanlondon