結果

問題 No.1707 Simple Range Reverse Problem
ユーザー rlangevinrlangevin
提出日時 2023-01-14 20:28:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 76,628 KB
最終ジャッジ日時 2023-08-27 01:30:52
合計ジャッジ時間 3,938 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,416 KB
testcase_01 AC 93 ms
75,688 KB
testcase_02 AC 74 ms
75,644 KB
testcase_03 AC 75 ms
75,676 KB
testcase_04 AC 73 ms
75,952 KB
testcase_05 AC 72 ms
75,672 KB
testcase_06 AC 74 ms
75,764 KB
testcase_07 AC 73 ms
75,648 KB
testcase_08 AC 71 ms
75,696 KB
testcase_09 AC 76 ms
76,284 KB
testcase_10 AC 76 ms
76,344 KB
testcase_11 AC 70 ms
75,792 KB
testcase_12 AC 82 ms
76,368 KB
testcase_13 AC 87 ms
76,324 KB
testcase_14 AC 86 ms
76,256 KB
testcase_15 AC 91 ms
76,628 KB
testcase_16 AC 87 ms
76,340 KB
testcase_17 AC 85 ms
76,236 KB
testcase_18 AC 88 ms
76,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
 
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    L = list(range(1, N + 1))
    L = L + L
    if A == L:
        print("Yes")
        continue
    for i in range(N):
        temp = L[:i] + L[i+N:i:-1] + L[i+N:]
        if temp == A:
            print("Yes")
            break
    else:
        print("No")    
0