結果

問題 No.3126 Dual Query Problem
コンテスト
ユーザー しょうゆ団子
提出日時 2025-04-25 22:10:24
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 207 ms / 2,000 ms
+ 456µs
コード長 823 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,025 ms
コンパイル使用メモリ 345,080 KB
実行使用メモリ 10,464 KB
最終ジャッジ日時 2026-07-12 11:16:30
合計ジャッジ時間 12,900 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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