結果

問題 No.1707 Simple Range Reverse Problem
ユーザー titiatitia
提出日時 2021-10-15 21:55:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 81,784 KB
実行使用メモリ 74,948 KB
最終ジャッジ日時 2023-10-17 20:16:12
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,488 KB
testcase_01 AC 42 ms
59,496 KB
testcase_02 AC 43 ms
59,496 KB
testcase_03 AC 42 ms
59,496 KB
testcase_04 AC 43 ms
61,544 KB
testcase_05 AC 42 ms
61,544 KB
testcase_06 AC 42 ms
59,496 KB
testcase_07 AC 42 ms
59,496 KB
testcase_08 AC 42 ms
61,544 KB
testcase_09 AC 52 ms
74,892 KB
testcase_10 AC 53 ms
74,876 KB
testcase_11 AC 43 ms
63,592 KB
testcase_12 AC 56 ms
74,884 KB
testcase_13 AC 61 ms
74,916 KB
testcase_14 AC 59 ms
74,872 KB
testcase_15 AC 66 ms
74,940 KB
testcase_16 AC 61 ms
74,948 KB
testcase_17 AC 58 ms
74,880 KB
testcase_18 AC 62 ms
74,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T=int(input())
for tests in range(T):
    N=int(input())
    A=list(map(int,input().split()))

    X=list(range(1,N+1))*2

    if X==A:
        print("Yes")
        continue

    for i in range(N):
        Y=X[:i]+X[i:i+N+1][::-1]+X[i+N+1:]
        #print(Y)
        if Y==A:
            print("Yes")
            break
    else:
        print("No")
0