結果

問題 No.1707 Simple Range Reverse Problem
ユーザー hir355hir355
提出日時 2021-10-15 21:33:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 74,828 KB
最終ジャッジ日時 2023-10-17 20:04:51
合計ジャッジ時間 2,019 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,444 KB
testcase_01 AC 45 ms
61,468 KB
testcase_02 AC 45 ms
59,420 KB
testcase_03 AC 45 ms
59,420 KB
testcase_04 AC 42 ms
61,468 KB
testcase_05 AC 43 ms
61,468 KB
testcase_06 AC 43 ms
61,468 KB
testcase_07 AC 43 ms
61,468 KB
testcase_08 AC 44 ms
61,468 KB
testcase_09 AC 52 ms
74,800 KB
testcase_10 AC 51 ms
74,792 KB
testcase_11 AC 42 ms
63,516 KB
testcase_12 AC 54 ms
74,796 KB
testcase_13 AC 60 ms
74,788 KB
testcase_14 AC 59 ms
74,780 KB
testcase_15 AC 67 ms
74,808 KB
testcase_16 AC 61 ms
74,828 KB
testcase_17 AC 57 ms
74,780 KB
testcase_18 AC 62 ms
74,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    x = list(range(1, n + 1)) + list(range(1, n + 1))
    for i in range(n):
        if x[:i + 1] + x[i + 1:i+n][::-1] + x[i+n:] == a:
            print('Yes')
            break
    else:
        if x == a:
            print('Yes')
        else:
            print('No')
0