結果
問題 |
No.3126 Dual Query Problem
|
ユーザー |
![]() |
提出日時 | 2025-04-28 00:26:28 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 196 ms / 2,000 ms |
コード長 | 882 bytes |
コンパイル時間 | 3,827 ms |
コンパイル使用メモリ | 287,704 KB |
実行使用メモリ | 13,056 KB |
最終ジャッジ日時 | 2025-06-20 02:54:03 |
合計ジャッジ時間 | 15,380 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, q; cin >> n >> q; vector<int> a(n); rep(i, n) cin >> a[i]; int cnt = 0; set<int> st; st.insert(0); rep(i, n) { if (!st.contains(a[i])) ++cnt, st.insert(a[i]); ++cnt; } if (cnt > q) { cout << "No" << '\n'; return 0; } cout << "Yes" << '\n'; st.erase(0); map<int, int> mp; int idx = 0; for (int x : st) mp[x] = idx++; for (auto [k, v] : mp) cout << 1 << ' ' << v + 1 << ' ' << k << '\n'; mp[0] = idx++; rep(i, n) cout << 2 << ' ' << mp[a[i]] + 1 << '\n'; rep(_, q - cnt) cout << 1 << ' ' << 1 << ' ' << 1 << '\n'; return 0; }