結果

問題 No.2254 Reverse Only
ユーザー shobonvipshobonvip
提出日時 2023-03-10 01:56:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 1,091 ms
コンパイル使用メモリ 81,608 KB
実行使用メモリ 118,552 KB
最終ジャッジ日時 2023-10-18 06:34:41
合計ジャッジ時間 7,724 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,728 KB
testcase_01 AC 38 ms
53,380 KB
testcase_02 AC 39 ms
53,380 KB
testcase_03 AC 37 ms
53,380 KB
testcase_04 AC 37 ms
53,380 KB
testcase_05 AC 37 ms
53,380 KB
testcase_06 AC 37 ms
53,380 KB
testcase_07 AC 36 ms
53,380 KB
testcase_08 AC 199 ms
114,404 KB
testcase_09 AC 211 ms
115,268 KB
testcase_10 AC 124 ms
108,384 KB
testcase_11 AC 199 ms
114,432 KB
testcase_12 AC 195 ms
114,796 KB
testcase_13 AC 126 ms
108,136 KB
testcase_14 AC 201 ms
114,996 KB
testcase_15 AC 207 ms
115,988 KB
testcase_16 AC 204 ms
113,640 KB
testcase_17 AC 203 ms
115,412 KB
testcase_18 AC 196 ms
114,992 KB
testcase_19 AC 179 ms
114,752 KB
testcase_20 AC 189 ms
115,572 KB
testcase_21 AC 189 ms
115,760 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

if a == b:
	print("Yes")
	exit()

if sorted(a) != sorted(b):
	print("No")
	exit()

if k > n:
	print("No")
elif k <= n - 2:
	print("Yes")
elif k == n:
	if a[::-1] == b:
		print("Yes")
	else:
		print("No")
else:
	for i in range(n):
		mode = 1
		for j in range(n):
			if a[(j+i)%n] != b[j]:
				mode = 0
				break
		if mode:
			print("Yes")
			exit()
	
	for i in range(n):
		mode = 1
		for j in range(n):
			if a[(j-i)%n] != b[j]:
				mode = 0
				break
		if mode:
			print("Yes")
			exit()
	
	print("No")	
0