結果

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

ソースコード

diff #

N, Q = map(int, input().split(' '))
X = [int(input()) for _ in range(N)]

def dual_query():
    a = set()
    query = []
    c = 0
    for i in X:
        if i in a:
            query.append((2, i))
            c += 1
        else:
            query.append((1, i, i))
            query.append((2, i))
            a.add(i)
            c += 2
        if c > Q:
            return print('No')
    while c < Q:
        query.append((1, 1, 1))
        c += 1
    print('Yes')
    for q in query:
        print(*q)

dual_query()
0