結果
問題 |
No.1425 Yet Another Cyclic Shifts Sorting
|
ユーザー |
![]() |
提出日時 | 2023-10-25 20:43:08 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 525 bytes |
コンパイル時間 | 552 ms |
コンパイル使用メモリ | 82,240 KB |
実行使用メモリ | 112,180 KB |
最終ジャッジ日時 | 2024-09-25 05:54:41 |
合計ジャッジ時間 | 7,578 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 12 RE * 9 |
ソースコード
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]] if L: ans.append(L) if len(ans) > 2: print(2) elif sorted(ans[1] + ans[0]) == sorted(A): print(1) else: print(2)