結果
| 問題 |
No.3126 Dual Query Problem
|
| コンテスト | |
| ユーザー |
rgnerdplayer
|
| 提出日時 | 2025-05-01 15:54:38 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| コード長 | 874 bytes |
| コンパイル時間 | 2,954 ms |
| コンパイル使用メモリ | 282,884 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2025-06-20 02:55:06 |
| 合計ジャッジ時間 | 11,101 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
int n, q;
cin >> n >> q;
vector<int> x(n);
for (int i = 0; i < n; i++) {
cin >> x[i];
}
auto sx = x;
sort(sx.begin(), sx.end());
sx.erase(unique(sx.begin(), sx.end()), sx.end());
if (sx.size() > q - n) {
cout << "No" << '\n';
return;
}
cout << "Yes" << '\n';
for (int i = 0; i < q - n; i++) {
cout << 1 << ' ' << i + 1 << ' ' << (i < sx.size() ? sx[i] : 1) << '\n';
}
for (int i = 0; i < n; i++) {
cout << 2 << ' ' << lower_bound(sx.begin(), sx.end(), x[i]) - sx.begin() + 1 << '\n';
}
};
solve();
return 0;
}
rgnerdplayer