結果

問題 No.1707 Simple Range Reverse Problem
ユーザー tamatotamato
提出日時 2021-10-15 21:27:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 75,044 KB
最終ジャッジ日時 2023-10-17 20:02:28
合計ジャッジ時間 1,958 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,620 KB
testcase_01 AC 43 ms
59,592 KB
testcase_02 AC 42 ms
59,592 KB
testcase_03 AC 43 ms
59,592 KB
testcase_04 AC 42 ms
61,640 KB
testcase_05 AC 42 ms
61,640 KB
testcase_06 AC 42 ms
61,640 KB
testcase_07 AC 42 ms
61,640 KB
testcase_08 AC 43 ms
61,640 KB
testcase_09 AC 52 ms
74,976 KB
testcase_10 AC 51 ms
74,980 KB
testcase_11 AC 42 ms
63,688 KB
testcase_12 AC 54 ms
74,980 KB
testcase_13 AC 59 ms
74,992 KB
testcase_14 AC 58 ms
74,984 KB
testcase_15 AC 66 ms
75,024 KB
testcase_16 AC 61 ms
75,024 KB
testcase_17 AC 56 ms
74,988 KB
testcase_18 AC 61 ms
75,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    for _ in range(int(input())):
        N = int(input())
        A = list(map(int, input().split()))
        B = list(range(1, N+1)) + list(range(1, N+1))

        ok = 0
        if A == B:
            ok = 1
        for i in range(N):
            C = B[:i] + B[i:i+N+1][::-1] + B[i+N+1:]
            if C == A:
                ok = 1
                break
        if ok:
            print("Yes")
        else:
            print("No")


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