結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー sgsw
提出日時 2021-08-15 00:04:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 106,368 KB
最終ジャッジ日時 2024-10-06 03:34:19
合計ジャッジ時間 6,826 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

'''
    Python3(PyPy3) Template for Programming-Contest.

    author : sgsw

    generated : 2021/08/14   
    when : 23:49:30

'''

import sys


def input():
    return sys.stdin.readline().rstrip()


DXY = [(0, -1), (1, 0), (0, 1), (-1, 0)]  # LDRU
mod = 998244353
inf = 1 << 64


def main():
    n = int(input())
    a = list(map(int,input().split()))
    if sorted(a) == a:
        print(0)
    else:
        #case 1
        b = [not a[i] <= a[i + 1] for i in range(n - 1)]
        if sum(b) == 1:
            print(1)
        else:
            print(2)
    return 0


if __name__ == "__main__":
    main()
0