結果

問題 No.1707 Simple Range Reverse Problem
ユーザー MineMine
提出日時 2022-01-07 18:49:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-11-14 05:01:11
合計ジャッジ時間 2,041 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    ans = [i for i in range(1, n+1)]*2
    if a == ans:
        print("Yes")
        continue
    for i in range(n):
        if a[:i] + a[i:i+n+1][::-1] + a[i+n+1:] == ans:
            a = []
            print("Yes")
            break
    if a != []:
        print("No")
0