結果

問題 No.3126 Dual Query Problem
ユーザー june19312
提出日時 2025-04-25 22:42:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 366 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 81,944 KB
実行使用メモリ 143,612 KB
最終ジャッジ日時 2025-06-20 02:46:58
合計ジャッジ時間 15,278 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q = map(int,input().split())

q = []
tmp = set()
for i in range(N):
    j = int(input())
    q.append(j)
    tmp.add(j)

nokori = Q-N
if nokori < len(tmp):
    print("No")
    exit()
done = set()
cnt = 1
ans = []
dic = {}

for i in q:
    if i not in done:
        done.add(i)
        ans.append([1,len(done),i])

        dic[i] = len(done)

for i in q:
    ans.append([2,dic[i]])

#print(ans)
while len(ans) < Q:
    ans.append([1,10**8,1])

print("Yes")

for i in ans:
    print(*i)
0