結果

問題 No.1707 Simple Range Reverse Problem
ユーザー binzamubinzamu
提出日時 2021-10-15 21:40:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 660 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 59,500 KB
最終ジャッジ日時 2023-10-17 20:08:17
合計ジャッジ時間 2,039 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,396 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 41 ms
59,360 KB
testcase_15 AC 40 ms
59,360 KB
testcase_16 AC 40 ms
59,360 KB
testcase_17 AC 40 ms
59,360 KB
testcase_18 AC 40 ms
59,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline().rstrip()

def main():
    # 1回調べれば良い
    t = int(input())
    for _ in range(t):
        n = int(input())
        a = list(map(int, input().split()))
        for i in range(n):
            if a[i] != i + 1:
                for j in range(n // 2 + 1):
                    a[i + j], a[i + n - j] = a[i + n - j], a[i + j]
                if a == list(range(1, n + 1)):
                    print("Yes")
                else:
                    print("No")

                break
        else:
            print("Yes")



if __name__ == '__main__':
    main()
0