結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-03-13 09:41:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 109,500 KB
最終ジャッジ日時 2024-04-23 03:26:05
合計ジャッジ時間 5,467 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,572 KB
testcase_01 AC 37 ms
52,504 KB
testcase_02 AC 38 ms
52,696 KB
testcase_03 AC 37 ms
52,412 KB
testcase_04 AC 38 ms
53,568 KB
testcase_05 AC 38 ms
51,996 KB
testcase_06 AC 38 ms
53,288 KB
testcase_07 AC 38 ms
52,072 KB
testcase_08 AC 38 ms
52,692 KB
testcase_09 AC 37 ms
52,464 KB
testcase_10 AC 38 ms
52,452 KB
testcase_11 AC 39 ms
52,948 KB
testcase_12 AC 38 ms
52,740 KB
testcase_13 AC 37 ms
53,544 KB
testcase_14 AC 38 ms
52,896 KB
testcase_15 AC 38 ms
53,120 KB
testcase_16 AC 37 ms
52,424 KB
testcase_17 AC 37 ms
52,216 KB
testcase_18 AC 38 ms
52,400 KB
testcase_19 AC 38 ms
53,224 KB
testcase_20 AC 38 ms
52,756 KB
testcase_21 AC 38 ms
52,696 KB
testcase_22 AC 80 ms
99,792 KB
testcase_23 AC 51 ms
71,016 KB
testcase_24 AC 50 ms
69,652 KB
testcase_25 AC 85 ms
102,672 KB
testcase_26 AC 100 ms
102,060 KB
testcase_27 AC 91 ms
106,080 KB
testcase_28 AC 105 ms
104,672 KB
testcase_29 AC 58 ms
77,788 KB
testcase_30 AC 54 ms
72,720 KB
testcase_31 AC 107 ms
105,600 KB
testcase_32 AC 55 ms
74,864 KB
testcase_33 AC 44 ms
61,960 KB
testcase_34 AC 58 ms
78,128 KB
testcase_35 AC 93 ms
106,428 KB
testcase_36 AC 99 ms
100,180 KB
testcase_37 AC 52 ms
66,788 KB
testcase_38 AC 140 ms
109,500 KB
testcase_39 AC 45 ms
60,296 KB
testcase_40 AC 110 ms
106,808 KB
testcase_41 AC 66 ms
77,828 KB
testcase_42 AC 71 ms
82,136 KB
testcase_43 AC 43 ms
61,604 KB
testcase_44 AC 49 ms
66,172 KB
testcase_45 AC 140 ms
109,396 KB
testcase_46 AC 140 ms
108,620 KB
testcase_47 AC 141 ms
109,004 KB
testcase_48 AC 139 ms
108,740 KB
testcase_49 AC 140 ms
108,488 KB
testcase_50 AC 38 ms
52,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))
sA = sorted(A)
mi = sA[0]
cand = []
for i,a in enumerate(A):
    if a == mi:
        cand.append(i)
for i in range(n)[::-1]:
    if A[i] != sA[i]:
        base = sA[:i+1]
        A = A[:i+1]
        for j in cand:
            c = A[j:]+A[:j]
            if c == base:
                print(1)
                exit()
        print(2)
        exit()
print(0)
0