結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー yuusanlondonyuusanlondon
提出日時 2021-03-12 23:05:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 113,024 KB
最終ジャッジ日時 2024-04-22 17:15:21
合計ジャッジ時間 6,213 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
52,096 KB
testcase_01 AC 46 ms
51,712 KB
testcase_02 AC 46 ms
51,712 KB
testcase_03 AC 49 ms
51,968 KB
testcase_04 AC 48 ms
52,096 KB
testcase_05 AC 48 ms
52,224 KB
testcase_06 AC 48 ms
51,840 KB
testcase_07 AC 47 ms
51,968 KB
testcase_08 AC 48 ms
51,840 KB
testcase_09 AC 47 ms
51,712 KB
testcase_10 AC 45 ms
52,480 KB
testcase_11 AC 48 ms
52,224 KB
testcase_12 AC 45 ms
52,224 KB
testcase_13 AC 45 ms
51,712 KB
testcase_14 AC 45 ms
52,096 KB
testcase_15 AC 44 ms
51,712 KB
testcase_16 AC 46 ms
51,968 KB
testcase_17 AC 46 ms
51,840 KB
testcase_18 AC 44 ms
51,712 KB
testcase_19 AC 45 ms
52,096 KB
testcase_20 AC 46 ms
51,712 KB
testcase_21 AC 47 ms
51,968 KB
testcase_22 AC 94 ms
97,408 KB
testcase_23 AC 61 ms
67,840 KB
testcase_24 AC 62 ms
67,072 KB
testcase_25 AC 101 ms
100,992 KB
testcase_26 AC 124 ms
101,632 KB
testcase_27 AC 127 ms
103,936 KB
testcase_28 AC 145 ms
112,544 KB
testcase_29 AC 87 ms
81,152 KB
testcase_30 AC 77 ms
75,520 KB
testcase_31 AC 140 ms
112,524 KB
testcase_32 AC 83 ms
78,976 KB
testcase_33 AC 63 ms
63,872 KB
testcase_34 AC 87 ms
83,968 KB
testcase_35 AC 126 ms
104,448 KB
testcase_36 AC 119 ms
107,136 KB
testcase_37 AC 73 ms
70,400 KB
testcase_38 AC 146 ms
112,760 KB
testcase_39 AC 66 ms
63,360 KB
testcase_40 AC 127 ms
100,864 KB
testcase_41 AC 86 ms
81,024 KB
testcase_42 AC 90 ms
86,784 KB
testcase_43 AC 65 ms
65,024 KB
testcase_44 AC 70 ms
69,248 KB
testcase_45 AC 143 ms
112,764 KB
testcase_46 AC 152 ms
112,756 KB
testcase_47 AC 147 ms
112,672 KB
testcase_48 AC 149 ms
113,024 KB
testcase_49 AC 146 ms
112,892 KB
testcase_50 AC 45 ms
51,968 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