結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー mkawa2mkawa2
提出日時 2021-03-13 10:47:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,083 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 29,800 KB
最終ジャッジ日時 2024-04-23 04:24:33
合計ジャッジ時間 4,642 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,880 KB
testcase_01 AC 27 ms
10,880 KB
testcase_02 AC 27 ms
10,880 KB
testcase_03 AC 27 ms
10,880 KB
testcase_04 WA -
testcase_05 AC 29 ms
10,880 KB
testcase_06 AC 29 ms
10,880 KB
testcase_07 AC 28 ms
10,880 KB
testcase_08 AC 29 ms
10,880 KB
testcase_09 AC 26 ms
10,880 KB
testcase_10 WA -
testcase_11 AC 25 ms
10,880 KB
testcase_12 AC 26 ms
10,880 KB
testcase_13 WA -
testcase_14 AC 27 ms
10,880 KB
testcase_15 AC 26 ms
10,880 KB
testcase_16 AC 26 ms
10,880 KB
testcase_17 AC 26 ms
10,880 KB
testcase_18 AC 26 ms
10,880 KB
testcase_19 WA -
testcase_20 AC 26 ms
10,880 KB
testcase_21 AC 26 ms
10,880 KB
testcase_22 AC 75 ms
25,804 KB
testcase_23 AC 39 ms
14,580 KB
testcase_24 AC 36 ms
13,972 KB
testcase_25 AC 77 ms
26,356 KB
testcase_26 AC 88 ms
29,456 KB
testcase_27 AC 111 ms
26,976 KB
testcase_28 AC 128 ms
29,628 KB
testcase_29 AC 65 ms
16,480 KB
testcase_30 AC 49 ms
14,844 KB
testcase_31 AC 128 ms
29,344 KB
testcase_32 AC 54 ms
16,324 KB
testcase_33 AC 31 ms
11,648 KB
testcase_34 AC 60 ms
17,064 KB
testcase_35 AC 122 ms
28,264 KB
testcase_36 AC 95 ms
23,332 KB
testcase_37 AC 40 ms
13,560 KB
testcase_38 AC 130 ms
29,568 KB
testcase_39 AC 30 ms
11,392 KB
testcase_40 AC 112 ms
25,976 KB
testcase_41 AC 55 ms
16,544 KB
testcase_42 AC 63 ms
18,008 KB
testcase_43 AC 31 ms
11,904 KB
testcase_44 AC 40 ms
13,404 KB
testcase_45 AC 131 ms
29,800 KB
testcase_46 AC 131 ms
29,668 KB
testcase_47 AC 130 ms
29,672 KB
testcase_48 AC 131 ms
29,668 KB
testcase_49 AC 131 ms
29,800 KB
testcase_50 AC 27 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7

from bisect import bisect

n = II()
aa = LI()
if aa == sorted(aa):
    print(0)
    exit()

cnt = 0
ri = r = -1
for i in range(n-1):
    if aa[i] > aa[i+1]:
        if r == -1:
            r = aa[i]
            ri = i
        else:
            print(2)
            exit()

for i in range(ri, n-1):
    if aa[i] <= aa[0] and r <= aa[i+1]:
        print(1)
        exit()
print(2)
0