結果

問題 No.1707 Simple Range Reverse Problem
ユーザー ああいい
提出日時 2021-12-28 17:02:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-10-02 09:52:53
合計ジャッジ時間 1,524 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)) + list(range(1,N+1))
    
    if A == X:
        print('Yes')
        continue
    flag = False
    for i in range(N):
        Y = X[:i] + X[i:i+N+1][::-1] + X[i+N+1:]
        if Y == A:
            print('Yes')
            flag = True
            break
    if flag == False:
        print('No')
0