結果

問題 No.3126 Dual Query Problem
ユーザー しょうゆ団子
提出日時 2025-04-25 22:10:24
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 381 ms / 2,000 ms
コード長 823 bytes
コンパイル時間 3,107 ms
コンパイル使用メモリ 283,612 KB
実行使用メモリ 10,192 KB
最終ジャッジ日時 2025-06-20 02:45:15
合計ジャッジ時間 16,175 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

struct f{
    int q, p, x;
};

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<f> ans;
    set<int> s;
    s.insert(0);
    for (int i = 0; i < N; i++) {
        int X;
        cin >> X;
        if (!s.contains(X)) {
            ans.emplace_back(1, X, X);
            s.insert(X);
        }
        ans.emplace_back(2, X, X);
    }
    if (ans.size() > Q) {
        cout << "No" << endl;
        return 0;
    } else {
        cout << "Yes" << endl;
    }
    while (ans.size() != Q) {
        ans.emplace_back(1, 1, 1);
    }
    for (int i = 0; i < ans.size(); i++) {
        if (ans[i].q == 1) {
            cout << 1 << ' ' << ans[i].p << ' ' << ans[i].x << endl;
        } else {
            cout << 2 << ' ' << ans[i].p << endl;
        }
    }
    return 0;
}
0