結果

問題 No.3126 Dual Query Problem
ユーザー miya145592
提出日時 2025-04-25 23:32:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 119,064 KB
最終ジャッジ日時 2025-06-20 02:48:20
合計ジャッジ時間 11,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
X = [int(input()) for _ in range(N)]
query = []
A = dict()
zero = 10**6
i = 0
for x in X:
    if x==0:
        query.append((2, zero))
        zero += 1
    else:
        if x in A:
            query.append((2, A[x]))
        else:
            query.append((1, i+1, x))
            query.append((2, i+1))
            A[x] = i+1
            i+=1
while len(query)<Q:
    query.append((1, i+1, 1))
    i+=1
if len(query)!=Q:
    print("No")
else:
    print("Yes")
    for q in query:
        print(*q)
0