結果

問題 No.3126 Dual Query Problem
ユーザー shimaaa
提出日時 2025-04-25 22:09:09
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,128 bytes
コンパイル時間 3,787 ms
コンパイル使用メモリ 284,944 KB
実行使用メモリ 8,352 KB
最終ジャッジ日時 2025-04-25 22:09:39
合計ジャッジ時間 14,554 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 18 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using LI = long long int;
using LD = long double;
using namespace std;
template <typename T>
using APQUE = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using DPQUE = priority_queue<T>;

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> printed(n);
    rep(i, n) {
        cin >> printed[i];
    }
    map<int, int> already_exist;
    already_exist[0] = 1;
    int nextplace = 2;
    rep(i, n) {
        if (printed[i] != 0) {
            if (!already_exist.contains(printed[i])) {
                already_exist[printed[i]] = nextplace;
                nextplace++;
            }
        }
    }
    if (q < n + already_exist.size()) {
        cout << "No" << endl;
        return 0;
    }
    for (auto i : already_exist) {
        if (i.first != 0) {
            cout << "1 " << i.second << " " << i.first << endl;
        }
    }
    for (auto i : printed) {
        cout << "2 " << already_exist[i] << endl;
    }
    rep(i, q - (already_exist.size() - 1 + printed.size())) {
        cout << "1 1 0" << endl;
    }
}
0