結果

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

ソースコード

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