結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー yuusanlondonyuusanlondon
提出日時 2021-03-12 23:05:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 114,096 KB
最終ジャッジ日時 2023-08-04 19:11:20
合計ジャッジ時間 6,928 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,524 KB
testcase_01 AC 65 ms
71,492 KB
testcase_02 AC 66 ms
71,408 KB
testcase_03 AC 69 ms
71,416 KB
testcase_04 AC 67 ms
71,352 KB
testcase_05 AC 64 ms
71,304 KB
testcase_06 AC 68 ms
71,248 KB
testcase_07 AC 64 ms
71,212 KB
testcase_08 AC 62 ms
71,368 KB
testcase_09 AC 67 ms
71,352 KB
testcase_10 AC 65 ms
71,336 KB
testcase_11 AC 68 ms
71,500 KB
testcase_12 AC 67 ms
71,384 KB
testcase_13 AC 64 ms
71,440 KB
testcase_14 AC 65 ms
71,600 KB
testcase_15 AC 65 ms
71,224 KB
testcase_16 AC 66 ms
71,264 KB
testcase_17 AC 69 ms
71,424 KB
testcase_18 AC 65 ms
71,216 KB
testcase_19 AC 64 ms
71,012 KB
testcase_20 AC 67 ms
71,356 KB
testcase_21 AC 66 ms
71,336 KB
testcase_22 AC 101 ms
101,636 KB
testcase_23 AC 75 ms
80,572 KB
testcase_24 AC 75 ms
79,816 KB
testcase_25 AC 104 ms
104,880 KB
testcase_26 AC 110 ms
100,184 KB
testcase_27 AC 131 ms
109,368 KB
testcase_28 AC 134 ms
113,892 KB
testcase_29 AC 91 ms
88,168 KB
testcase_30 AC 90 ms
83,616 KB
testcase_31 AC 135 ms
113,888 KB
testcase_32 AC 90 ms
86,768 KB
testcase_33 AC 78 ms
76,376 KB
testcase_34 AC 94 ms
90,292 KB
testcase_35 AC 131 ms
109,948 KB
testcase_36 AC 111 ms
98,720 KB
testcase_37 AC 83 ms
79,820 KB
testcase_38 AC 134 ms
114,004 KB
testcase_39 AC 74 ms
76,420 KB
testcase_40 AC 117 ms
101,988 KB
testcase_41 AC 89 ms
88,460 KB
testcase_42 AC 93 ms
92,328 KB
testcase_43 AC 76 ms
76,660 KB
testcase_44 AC 81 ms
79,120 KB
testcase_45 AC 138 ms
113,904 KB
testcase_46 AC 137 ms
114,096 KB
testcase_47 AC 134 ms
114,096 KB
testcase_48 AC 135 ms
114,028 KB
testcase_49 AC 134 ms
114,016 KB
testcase_50 AC 66 ms
71,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
flag=0
for i in range(n-1):
    if a[i+1]<a[i]:
        flag=1
if not flag:
    print(0)
    exit()
k=min(a)
b=[]
for i in range(n-1,-1,-1):
    if a[i]==k and (i==0 or a[i-1]!=k):
        j=i+1
        b=[a[i]]
        while j<n and a[j]<=a[0]:
            b.append(a[j])
            j+=1
        for k in range(i):
            b.append(a[k])
        for k in range(j,n):
            b.append(a[k])
        break
flag=0
for i in range(n-1):
    if b[i+1]<b[i]:
        flag=1
if not flag:
    print(1)
    exit() 
print(2)
0