結果

問題 No.1707 Simple Range Reverse Problem
ユーザー roarisroaris
提出日時 2021-10-21 12:27:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,768 KB
実行使用メモリ 75,132 KB
最終ジャッジ日時 2023-10-21 06:24:29
合計ジャッジ時間 2,619 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,436 KB
testcase_01 AC 47 ms
61,744 KB
testcase_02 AC 47 ms
61,744 KB
testcase_03 AC 47 ms
61,744 KB
testcase_04 AC 48 ms
63,792 KB
testcase_05 AC 48 ms
63,792 KB
testcase_06 AC 47 ms
61,688 KB
testcase_07 AC 47 ms
61,688 KB
testcase_08 AC 47 ms
61,688 KB
testcase_09 AC 58 ms
75,016 KB
testcase_10 AC 56 ms
75,032 KB
testcase_11 AC 46 ms
63,732 KB
testcase_12 AC 61 ms
75,028 KB
testcase_13 AC 66 ms
75,076 KB
testcase_14 AC 67 ms
75,044 KB
testcase_15 AC 73 ms
75,080 KB
testcase_16 AC 68 ms
75,052 KB
testcase_17 AC 63 ms
75,032 KB
testcase_18 AC 67 ms
75,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

for _ in range(int(input())):
    N = int(input())
    X = [i%N+1 for i in range(2*N)]
    A = list(map(int, input().split()))

    if A==X:
        print('Yes')
        continue
    
    for i in range(N):
        Y = X[:i]+list(reversed(X[i:i+N+1]))+X[i+N+1:]
        
        if A==Y:
            print('Yes')
            break
    else:
        print('No')
0