結果

問題 No.3750 Mischievous Resident (Easy)
コンテスト
ユーザー Unbakedbread
提出日時 2026-10-06 21:18:04
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 406 ms / 2,000 ms
+ 121µs
コード長 415 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,522 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 129,316 KB
最終ジャッジ日時 2026-10-06 21:18:21
合計ジャッジ時間 11,534 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

for _ in range(int(input())):
	N, M = map(int, input().split())
	S = list(map(int, input().split()))
	G = list(map(int, input().split()))
	
	A = sorted([(S[i], G[i]) for i in range(M)])
	
	ans = True
	for i in range(M - 1):
		if A[i][1] > A[i + 1][1]:
			ans = False
			break
		if A[i][1] == A[i + 1][1]:
			if A[i][0] == A[i + 1][0] == A[i][1]:
				continue
			ans = False
			break
	
	print("Yes" if ans else "No")
0