結果

問題 No.3126 Dual Query Problem
ユーザー Facade
提出日時 2025-04-25 21:35:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 321 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 102,128 KB
最終ジャッジ日時 2025-06-20 02:40:56
合計ジャッジ時間 15,760 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,q=map(int,input().split())
ans=[]
idx=1
pl=defaultdict(lambda:0)
for i in range(n):
    x=int(input())
    if pl[x]!=0:
        ans.append((2,pl[x]))
        continue
    pl[x]=idx
    ans.append((1,idx,x))
    ans.append((2,idx))
    idx+=1
for _ in range(q-len(ans)):
    ans.append((1,1,1))
if len(ans)>q:
    print("No")
else:
    print("Yes")
    for row in ans:
        print(*row)
0