結果

問題 No.3126 Dual Query Problem
ユーザー Apollo@Kuro
提出日時 2025-03-04 20:23:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,336 KB
実行使用メモリ 109,372 KB
最終ジャッジ日時 2025-06-20 02:22:15
合計ジャッジ時間 13,766 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N, Q = map(int, input().split())
assert 1 <= N <= Q <= 2 * 10 ** 5

D, cnt = defaultdict(int), 0
tmp = []
for i in range(N):
	X = int(input())
	assert 1 <= X <= 10 ** 9
	if not D[X]:
		D[X] = i+1
		tmp.append([1, i+1, X])
		cnt += 1
	cnt += 1
	tmp.append([2, D[X]])
	
	if cnt > Q:
		exit(print('No'))

print('Yes')
while cnt < Q:
	tmp.append([1, 1, 10])
	cnt += 1

for ans in tmp:
	print(*ans)
0