結果

問題 No.1707 Simple Range Reverse Problem
コンテスト
ユーザー Igrmi
提出日時 2021-10-15 21:36:49
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 40 ms / 2,000 ms
+ 711µs
コード長 350 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,909 ms
コンパイル使用メモリ 64,208 KB
実行使用メモリ 58,692 KB
最終ジャッジ日時 2026-10-15 20:21:48
合計ジャッジ時間 2,803 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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