結果

問題 No.1707 Simple Range Reverse Problem
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-10-17 01:07:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 11,848 KB
実行使用メモリ 10,384 KB
最終ジャッジ日時 2023-10-17 22:18:47
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,084 KB
testcase_01 AC 31 ms
10,088 KB
testcase_02 AC 30 ms
10,088 KB
testcase_03 AC 30 ms
10,088 KB
testcase_04 AC 31 ms
10,124 KB
testcase_05 AC 30 ms
10,124 KB
testcase_06 AC 30 ms
10,096 KB
testcase_07 AC 30 ms
10,096 KB
testcase_08 AC 30 ms
10,096 KB
testcase_09 AC 37 ms
10,312 KB
testcase_10 AC 35 ms
10,336 KB
testcase_11 AC 30 ms
10,328 KB
testcase_12 AC 39 ms
10,356 KB
testcase_13 AC 45 ms
10,372 KB
testcase_14 AC 43 ms
10,308 KB
testcase_15 AC 51 ms
10,384 KB
testcase_16 AC 46 ms
10,336 KB
testcase_17 AC 42 ms
10,312 KB
testcase_18 AC 48 ms
10,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = list(range(1, n + 1)) * 2
	if a == x: print("Yes"); continue
	for i in range(n):
		a2 = x[:i] + x[i:i + n + 1][::-1] + x[i + n + 1:]
		if a2 == a: print("Yes"); break
	else:
		print("No")
0