結果

問題 No.1707 Simple Range Reverse Problem
ユーザー FromBooskaFromBooska
提出日時 2023-09-24 19:02:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 77,764 KB
最終ジャッジ日時 2023-09-24 19:03:03
合計ジャッジ時間 3,594 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,252 KB
testcase_01 AC 85 ms
76,552 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 87 ms
76,512 KB
testcase_05 AC 113 ms
76,472 KB
testcase_06 AC 85 ms
76,520 KB
testcase_07 AC 85 ms
76,552 KB
testcase_08 AC 102 ms
77,764 KB
testcase_09 AC 115 ms
76,948 KB
testcase_10 AC 115 ms
77,008 KB
testcase_11 AC 99 ms
76,996 KB
testcase_12 AC 116 ms
77,340 KB
testcase_13 AC 131 ms
77,160 KB
testcase_14 AC 104 ms
76,928 KB
testcase_15 AC 119 ms
76,796 KB
testcase_16 AC 106 ms
76,904 KB
testcase_17 AC 103 ms
76,872 KB
testcase_18 AC 103 ms
77,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# ACしたがBから変形するなら二重ループいらないのでそうする
# 作れるパターンをリストアウトしてわかったのだが操作は0回か1回しかない
# ということは最初からAになっているか、操作1回するかでAになるかだけ調べればいいか

T = int(input())
for t in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    B = [a for a in range(1, N+1)]+[a for a in range(1, N+1)]
    ans = 'No'
    if B == A:
        ans = 'Yes'
    for i in range(N*2):
        j = i+N
        temp = B[:i]+B[i:j+1][::-1]+B[j+1:]
        if temp == A:
            ans = 'Yes'
    print(ans)

0