結果
| 問題 |
No.1425 Yet Another Cyclic Shifts Sorting
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-13 00:00:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 81,732 KB |
| 実行使用メモリ | 131,400 KB |
| 最終ジャッジ日時 | 2024-10-14 14:21:21 |
| 合計ジャッジ時間 | 5,493 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 43 WA * 5 |
ソースコード
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
if A==list(sorted(A)):
print(0)
exit()
down = [0, 0]
for i in range(N-1):
down.append(down[-1]+(1 if A[i]>A[i+1] else 0))
M = [0]
for i in range(N):
M.append(max(M[-1], A[i]))
if down[N]==1 and A[-1]==min(A):
print(1)
exit()
for i in range(N-2, 0, -1):
if A[i]<=A[i+1]:
if down[i-1]==1 and M[i]<=A[i]:
print(1)
exit()
else:
break
print(2)