結果
| 問題 |
No.3126 Dual Query Problem
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2025-05-13 21:18:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 114 ms / 2,000 ms |
| コード長 | 769 bytes |
| コンパイル時間 | 1,953 ms |
| コンパイル使用メモリ | 208,876 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2025-06-20 02:56:13 |
| 合計ジャッジ時間 | 10,311 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
int main() {
fast_io();
int n, q;
cin >> n >> q;
vector<int> x(n);
for (int i = 0; i < n; i++) {
cin >> x[i];
}
vector<int> xs = x;
sort(xs.begin(), xs.end());
xs.erase(unique(xs.begin(), xs.end()), xs.end());
if (n + xs.size() > q) {
cout << "No" << endl;
return 0;
}
cout << "Yes" << endl;
int cur = 1;
int cnt = 0;
map<int, int> idx;
for (int i = 0; i < n; i++) {
if (idx.find(x[i]) == idx.end()) {
cout << "1 " << cur << " " << x[i] << "\n";
idx[x[i]] = cur++;
cnt++;
}
cout << "2 " << idx[x[i]] << "\n";
cnt++;
}
for (int i = 0; i < q - cnt; i++) {
cout << "1 " << (int)1e9 << " " << 1 << "\n";
}
}
eve__fuyuki