結果
| 問題 |
No.3126 Dual Query Problem
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2025-04-26 00:25:09 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 201 ms / 2,000 ms |
| コード長 | 968 bytes |
| コンパイル時間 | 3,719 ms |
| コンパイル使用メモリ | 285,084 KB |
| 実行使用メモリ | 20,176 KB |
| 最終ジャッジ日時 | 2025-06-20 02:49:58 |
| 合計ジャッジ時間 | 16,518 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n,q;
cin>>n>>q;
VV<int> ANS;
map<int,int> m;
int now=1;
V<int> X(n);
rep(i,n){
int x;
cin>>x;
X[i]=x;
if(!m.contains(x)) m[x]=now++;
}
for(auto [a,b]:m){
V<int> A(3);
A[0]=1,A[1]=b,A[2]=a;
ANS.push_back(A);
}
rep(i,n){
V<int> A(2);
A[0]=2,A[1]=m[X[i]];
ANS.push_back(A);
}
int a=ANS.size();
if(a>q) cout<<"No"<<'\n';
else{
rep(i,q-a){
V<int> A(3);
A[0]=1,A[1]=1,A[2]=1;
ANS.push_back(A);
}
cout<<"Yes"<<'\n';
rep(i,q){
int b=ANS[i].size();
rep(j,b){
if(j) cout<<" ";
cout<<ANS[i][j];
}
cout<<'\n';
}
}
return 0;
}
umezo