結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー Kude
提出日時 2021-03-12 21:59:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 357 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 104,580 KB
最終ジャッジ日時 2024-10-14 12:23:17
合計ジャッジ時間 4,704 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
i = 1
while i < n and a[i-1] <= a[i]:
    i += 1
if i == n:
    print(0)
    exit()
mx = a[i-1]
i += 1
while i < n and a[i-1] <= a[i] and a[i] <= a[0]:
    i += 1
if i < n and a[i] < mx:
    print(2)
    exit()
i += 1
while i < n and a[i-1] <= a[i]:
    i += 1
if i >= n:
    print(1)
else:
    print(2)
0