結果

問題 No.1707 Simple Range Reverse Problem
ユーザー hirayuu_yc
提出日時 2025-01-11 09:27:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 75,276 KB
最終ジャッジ日時 2025-01-11 09:27:23
合計ジャッジ時間 2,742 ms
ジャッジサーバーID
(参考情報)
judge1 / 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))*2
    ans="No"
    for i in range(N):
        if A==X[:i+1]+X[i+1:i+N][::-1]+X[i+N:]:
            ans="Yes"
    if A==X:
        ans="Yes"
    print(ans)
0