結果

問題 No.1707 Simple Range Reverse Problem
ユーザー ntudantuda
提出日時 2022-03-10 12:12:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 76,404 KB
最終ジャッジ日時 2023-10-12 14:30:06
合計ジャッジ時間 3,742 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,304 KB
testcase_01 AC 78 ms
75,452 KB
testcase_02 AC 90 ms
75,516 KB
testcase_03 AC 85 ms
75,504 KB
testcase_04 AC 86 ms
76,052 KB
testcase_05 AC 88 ms
75,760 KB
testcase_06 AC 86 ms
76,276 KB
testcase_07 AC 80 ms
76,280 KB
testcase_08 AC 80 ms
76,404 KB
testcase_09 AC 79 ms
76,188 KB
testcase_10 AC 80 ms
76,280 KB
testcase_11 AC 78 ms
75,848 KB
testcase_12 AC 79 ms
76,244 KB
testcase_13 AC 79 ms
76,332 KB
testcase_14 AC 76 ms
75,480 KB
testcase_15 AC 77 ms
75,960 KB
testcase_16 AC 88 ms
75,452 KB
testcase_17 AC 83 ms
75,464 KB
testcase_18 AC 89 ms
75,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for t in range(T):
    N = int(input())
    A = list(map(int, input().split()))

    if sorted(A) != sorted(list(range(1,N+1)) * 2):
        print("No")
        continue
    if A[0] != 1 or A[2 * N - 1] != N:
        print("No")
        continue

    for i in range(1, 2 * N):
        if not(abs(A[i] - A[i - 1]) == 1 or abs(A[i] - A[i - 1]) == N - 1):
            print("No")
            break
    else:
        print("Yes")
0