結果

問題 No.3126 Dual Query Problem
ユーザー SPD_9X2
提出日時 2025-04-25 21:31:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 82,116 KB
実行使用メモリ 118,568 KB
最終ジャッジ日時 2025-06-20 02:39:43
合計ジャッジ時間 12,611 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

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

X = [ int(input()) for i in range(N) ]

dic = {}

ans = []

for i in range(N):

    if X[i] in dic:
        ans.append( (2,dic[X[i]]) )
    else:
        p = len(dic) + 1
        ans.append( (1,p,X[i]) )
        dic[X[i]] = p
        ans.append( (2,p) )

while len(ans) < Q:
    ans.append( (1,10**9,1) )

if len(ans) == Q:
    print ("Yes")
    for tup in ans:
        print (*tup)
else:
    print ("No")
0