結果
問題 |
No.1425 Yet Another Cyclic Shifts Sorting
|
ユーザー |
![]() |
提出日時 | 2023-10-25 20:45:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 177 ms / 2,000 ms |
コード長 | 519 bytes |
コンパイル時間 | 293 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 111,088 KB |
最終ジャッジ日時 | 2024-09-25 05:54:47 |
合計ジャッジ時間 | 6,096 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 |
ソースコード
from copy import * N = int(input()) A = list(map(int, input().split())) D = sorted(deepcopy(A)) for i in range(N): if A[-1] == D[-1]: A.pop() D.pop() if A == []: print(0) exit() pre = A[0] N = len(A) L = [A[0]] ans = [] for i in range(1, N): if A[i] >= pre: L.append(A[i]) else: ans.append(L) L = [A[i]] pre = A[i] if L: ans.append(L) if len(ans) > 2: print(2) elif ans[1] + ans[0] == D: print(1) else: print(2)