結果
問題 |
No.3126 Dual Query Problem
|
ユーザー |
|
提出日時 | 2025-04-25 22:21:12 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 465 ms / 2,000 ms |
コード長 | 1,161 bytes |
コンパイル時間 | 4,832 ms |
コンパイル使用メモリ | 283,484 KB |
実行使用メモリ | 8,224 KB |
最終ジャッジ日時 | 2025-06-20 02:46:15 |
合計ジャッジ時間 | 18,378 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#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() - 1)) { cout << "No" << endl; return 0; } cout << "Yes" << endl; 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 1" << endl; } }