結果

問題 No.1707 Simple Range Reverse Problem
ユーザー mesame3993mesame3993
提出日時 2021-10-15 22:32:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 570 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 99,784 KB
最終ジャッジ日時 2023-10-17 20:31:56
合計ジャッジ時間 3,943 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,524 KB
testcase_01 AC 51 ms
62,136 KB
testcase_02 AC 51 ms
62,136 KB
testcase_03 AC 51 ms
62,136 KB
testcase_04 AC 57 ms
68,756 KB
testcase_05 AC 55 ms
66,676 KB
testcase_06 AC 51 ms
64,580 KB
testcase_07 AC 50 ms
64,580 KB
testcase_08 AC 50 ms
64,580 KB
testcase_09 AC 65 ms
75,788 KB
testcase_10 AC 63 ms
75,928 KB
testcase_11 AC 44 ms
62,128 KB
testcase_12 AC 75 ms
75,836 KB
testcase_13 AC 88 ms
75,856 KB
testcase_14 AC 239 ms
86,244 KB
testcase_15 AC 569 ms
96,540 KB
testcase_16 AC 430 ms
95,056 KB
testcase_17 AC 312 ms
95,956 KB
testcase_18 AC 570 ms
99,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	ans = [x+1 for x in range(n)] * 2
	for i in range(2*n):
		if A == ans:
			print('Yes')
			break
		tmp = [A[i]]
		for j in range(i+1, 2*n):
			tmp.append(A[j])
			if A[j] == tmp[0]:
				k = j
				break
		t = list(reversed(tmp))
		if tmp == t:
			continue
		A[i:k+1] = t
		if A == ans:
			print('Yes')
			break
	else:
		print('No')
0