結果
問題 |
No.3126 Dual Query Problem
|
ユーザー |
![]() |
提出日時 | 2025-04-25 21:59:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 387 ms / 2,000 ms |
コード長 | 1,119 bytes |
コンパイル時間 | 5,559 ms |
コンパイル使用メモリ | 333,884 KB |
実行使用メモリ | 13,568 KB |
最終ジャッジ日時 | 2025-06-20 02:44:48 |
合計ジャッジ時間 | 18,855 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; using namespace chrono; #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif int main() { int64_t n, q; cin >> n >> q; vector<int64_t> xs(n); for (auto &&x : xs) { cin >> x; } vector<int64_t> ops(q), ps(q), ts(q); set<int64_t> st; int64_t k = 0; for (int64_t i = 0; i < q; i++) { if (k < n && st.contains(xs[k])) { ops[i] = 2; ps[i] = xs[k]; k++; } else if (k < n) { ops[i] = 1; ps[i] = xs[k]; ts[i] = xs[k]; st.insert(xs[k]); } else { ops[i] = 1; ps[i] = 1; ts[i] = 1; } } if (k < n) { cout << "No" << endl; return 0; } cout << "Yes" << endl; for (int64_t i = 0; i < q; i++) { cout << ops[i] << ' ' << ps[i] << ' '; if (ops[i] == 1) { cout << ts[i]; } cout << endl; } return 0; }