結果

問題 No.1707 Simple Range Reverse Problem
ユーザー IgrmiIgrmi
提出日時 2021-10-15 21:36:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 74,908 KB
最終ジャッジ日時 2023-10-17 20:06:39
合計ジャッジ時間 1,923 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,500 KB
testcase_01 AC 44 ms
59,516 KB
testcase_02 AC 44 ms
59,516 KB
testcase_03 AC 45 ms
59,516 KB
testcase_04 AC 43 ms
61,564 KB
testcase_05 AC 43 ms
61,564 KB
testcase_06 AC 43 ms
61,564 KB
testcase_07 AC 44 ms
61,564 KB
testcase_08 AC 45 ms
61,564 KB
testcase_09 AC 52 ms
74,876 KB
testcase_10 AC 52 ms
74,892 KB
testcase_11 AC 42 ms
61,564 KB
testcase_12 AC 55 ms
74,880 KB
testcase_13 AC 60 ms
74,908 KB
testcase_14 AC 60 ms
74,888 KB
testcase_15 AC 65 ms
74,892 KB
testcase_16 AC 60 ms
74,900 KB
testcase_17 AC 56 ms
74,892 KB
testcase_18 AC 61 ms
74,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    B = list(range(1, N + 1)) + list(range(1, N + 1))
    if A == B:
        print('Yes')
        continue
    for i in range(N):
        if B[:i + 1] + B[i + N - 1:i:-1] + B[i + N:] == A:
            print('Yes')
            break
    else: print('No')
0