結果
| 問題 |
No.3126 Dual Query Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-25 22:12:34 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,155 bytes |
| コンパイル時間 | 3,650 ms |
| コンパイル使用メモリ | 284,224 KB |
| 実行使用メモリ | 8,396 KB |
| 最終ジャッジ日時 | 2025-04-25 22:12:52 |
| 合計ジャッジ時間 | 18,080 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 18 WA * 14 |
ソースコード
#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;
}
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 0" << endl;
}
}