結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-03-13 00:28:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 106,112 KB
最終ジャッジ日時 2024-04-22 17:19:13
合計ジャッジ時間 5,383 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,096 KB
testcase_01 AC 37 ms
52,096 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 38 ms
51,968 KB
testcase_04 AC 38 ms
52,224 KB
testcase_05 AC 38 ms
52,224 KB
testcase_06 AC 38 ms
51,968 KB
testcase_07 AC 37 ms
51,840 KB
testcase_08 AC 37 ms
52,224 KB
testcase_09 AC 37 ms
52,224 KB
testcase_10 AC 37 ms
51,840 KB
testcase_11 AC 38 ms
51,968 KB
testcase_12 AC 38 ms
51,968 KB
testcase_13 AC 37 ms
51,840 KB
testcase_14 AC 36 ms
52,096 KB
testcase_15 AC 37 ms
51,840 KB
testcase_16 AC 37 ms
51,840 KB
testcase_17 AC 39 ms
52,352 KB
testcase_18 AC 37 ms
52,224 KB
testcase_19 AC 36 ms
51,968 KB
testcase_20 AC 36 ms
52,224 KB
testcase_21 AC 36 ms
52,096 KB
testcase_22 AC 85 ms
100,096 KB
testcase_23 AC 52 ms
69,504 KB
testcase_24 AC 51 ms
68,096 KB
testcase_25 AC 89 ms
103,936 KB
testcase_26 AC 101 ms
102,904 KB
testcase_27 AC 94 ms
106,112 KB
testcase_28 AC 102 ms
100,440 KB
testcase_29 AC 61 ms
75,392 KB
testcase_30 AC 58 ms
70,912 KB
testcase_31 AC 108 ms
100,664 KB
testcase_32 AC 59 ms
74,112 KB
testcase_33 AC 47 ms
61,696 KB
testcase_34 AC 62 ms
77,952 KB
testcase_35 AC 93 ms
104,192 KB
testcase_36 AC 99 ms
94,336 KB
testcase_37 AC 54 ms
66,560 KB
testcase_38 AC 140 ms
102,164 KB
testcase_39 AC 48 ms
61,312 KB
testcase_40 AC 113 ms
100,224 KB
testcase_41 AC 71 ms
75,264 KB
testcase_42 AC 75 ms
79,360 KB
testcase_43 AC 47 ms
62,208 KB
testcase_44 AC 56 ms
66,176 KB
testcase_45 AC 135 ms
102,120 KB
testcase_46 AC 136 ms
101,608 KB
testcase_47 AC 140 ms
102,228 KB
testcase_48 AC 134 ms
102,124 KB
testcase_49 AC 135 ms
102,380 KB
testcase_50 AC 39 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin
import bisect

N = int(stdin.readline())
A = list(map(int,stdin.readline().split()))
B = [A[i] for i in range(N)]
B.sort()

while len(A) > 0 and B[-1] == A[-1]:
    del A[-1]
    del B[-1]

if len(A) == 0:
    print (0)
    sys.exit()


rev = 0
for i in range(len(A)):
    if A[i] > A[(i+1) % len(A)]:
        rev += 1

if rev <= 1:
    print (1)
else:
    print (2)
0