結果

問題 No.1707 Simple Range Reverse Problem
コンテスト
ユーザー Igrmi
提出日時 2021-10-15 21:36:49
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 71 ms / 2,000 ms
+ 583µs
コード長 350 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 227 ms
コンパイル使用メモリ 95,724 KB
実行使用メモリ 83,336 KB
最終ジャッジ日時 2026-07-13 05:21:45
合計ジャッジ時間 2,865 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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