結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー rlangevinrlangevin
提出日時 2023-10-25 20:45:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 110,556 KB
最終ジャッジ日時 2023-10-25 20:45:38
合計ジャッジ時間 7,751 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,232 KB
testcase_01 AC 41 ms
53,232 KB
testcase_02 AC 40 ms
53,232 KB
testcase_03 AC 40 ms
53,232 KB
testcase_04 AC 40 ms
53,232 KB
testcase_05 AC 41 ms
53,232 KB
testcase_06 AC 41 ms
53,232 KB
testcase_07 AC 41 ms
53,232 KB
testcase_08 AC 41 ms
53,232 KB
testcase_09 AC 41 ms
53,232 KB
testcase_10 AC 41 ms
53,232 KB
testcase_11 AC 40 ms
53,232 KB
testcase_12 AC 41 ms
53,232 KB
testcase_13 AC 39 ms
53,232 KB
testcase_14 AC 39 ms
53,232 KB
testcase_15 AC 40 ms
53,232 KB
testcase_16 AC 41 ms
53,232 KB
testcase_17 AC 40 ms
53,232 KB
testcase_18 AC 40 ms
53,232 KB
testcase_19 AC 41 ms
53,232 KB
testcase_20 AC 41 ms
53,232 KB
testcase_21 AC 41 ms
53,232 KB
testcase_22 AC 110 ms
100,416 KB
testcase_23 AC 69 ms
82,240 KB
testcase_24 AC 62 ms
78,316 KB
testcase_25 AC 112 ms
102,888 KB
testcase_26 AC 127 ms
106,732 KB
testcase_27 AC 120 ms
103,080 KB
testcase_28 AC 141 ms
106,976 KB
testcase_29 AC 80 ms
84,984 KB
testcase_30 AC 76 ms
82,596 KB
testcase_31 AC 140 ms
108,064 KB
testcase_32 AC 77 ms
84,144 KB
testcase_33 AC 55 ms
68,388 KB
testcase_34 AC 81 ms
86,008 KB
testcase_35 AC 134 ms
105,640 KB
testcase_36 AC 130 ms
97,180 KB
testcase_37 AC 73 ms
80,048 KB
testcase_38 AC 182 ms
110,556 KB
testcase_39 AC 55 ms
66,336 KB
testcase_40 AC 143 ms
99,980 KB
testcase_41 AC 89 ms
84,768 KB
testcase_42 AC 96 ms
87,208 KB
testcase_43 AC 58 ms
70,432 KB
testcase_44 AC 72 ms
79,660 KB
testcase_45 AC 181 ms
109,776 KB
testcase_46 AC 180 ms
109,172 KB
testcase_47 AC 181 ms
109,688 KB
testcase_48 AC 179 ms
109,212 KB
testcase_49 AC 180 ms
109,732 KB
testcase_50 AC 41 ms
53,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)    
0