結果

問題 No.1707 Simple Range Reverse Problem
ユーザー hir355
提出日時 2021-10-15 21:33:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 75,280 KB
最終ジャッジ日時 2024-09-17 17:16:30
合計ジャッジ時間 1,677 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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