結果

問題 No.1707 Simple Range Reverse Problem
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-10-16 10:22:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 72,448 KB
最終ジャッジ日時 2023-10-17 22:04:23
合計ジャッジ時間 1,935 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,372 KB
testcase_01 AC 50 ms
61,872 KB
testcase_02 AC 50 ms
62,004 KB
testcase_03 AC 49 ms
61,532 KB
testcase_04 AC 49 ms
62,012 KB
testcase_05 AC 49 ms
62,008 KB
testcase_06 AC 49 ms
62,008 KB
testcase_07 AC 49 ms
62,008 KB
testcase_08 AC 50 ms
62,008 KB
testcase_09 AC 50 ms
64,056 KB
testcase_10 AC 49 ms
64,056 KB
testcase_11 AC 45 ms
59,484 KB
testcase_12 AC 52 ms
66,104 KB
testcase_13 AC 56 ms
70,200 KB
testcase_14 AC 55 ms
68,152 KB
testcase_15 AC 60 ms
72,448 KB
testcase_16 AC 56 ms
68,152 KB
testcase_17 AC 53 ms
66,104 KB
testcase_18 AC 54 ms
66,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    A = list(map(int,input().split()))
    base = [i for i in range(1,n+1)]*2
    if base == A:
        return "Yes"
    for i in range(n):
        for j in range(n//2+1):
            base[i+j],base[i+n-j] = base[i+n-j],base[i+j]
        if base == A:
            return "Yes"
        for j in range(n//2+1):
            base[i+j],base[i+n-j] = base[i+n-j],base[i+j]
    return "No"
t = int(input())
for _ in range(t):
    print(solve())
0