結果

問題 No.1707 Simple Range Reverse Problem
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-10-17 01:07:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-17 19:33:00
合計ジャッジ時間 1,361 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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