結果
問題 | No.3126 Dual Query Problem |
ユーザー |
|
提出日時 | 2025-04-25 21:29:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 771 bytes |
コンパイル時間 | 2,272 ms |
コンパイル使用メモリ | 208,644 KB |
実行使用メモリ | 9,968 KB |
最終ジャッジ日時 | 2025-06-20 02:39:00 |
合計ジャッジ時間 | 12,632 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,Q; cin >> N >> Q; vector<int> X(N); for(auto &x : X) cin >> x; map<int,int> A; A[-1] = 0; vector<pair<int,int>> Kotonoha; for(auto x : X){ if(A.count(x)) Kotonoha.push_back({A[x],-1}); else{ A[x] = A.size(); Kotonoha.push_back({A[x],x}); Kotonoha.push_back({A[x],-1}); } } if(Kotonoha.size() > Q){cout << "No\n"; return 0;} while(Kotonoha.size() < Q) Kotonoha.push_back({1,1}); cout << "Yes\n"; for(auto [a,b] : Kotonoha){ if(b == -1) cout << 2 << " " << a << "\n"; else cout << 1 << " " << a << " " << b << "\n"; } }