結果

問題 No.3126 Dual Query Problem
ユーザー 沙耶花
提出日時 2025-04-25 21:28:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 824 bytes
コンパイル時間 4,221 ms
コンパイル使用メモリ 256,044 KB
実行使用メモリ 10,596 KB
最終ジャッジ日時 2025-06-20 02:38:29
合計ジャッジ時間 17,686 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001LL

int main(){
	
	int N,Q;
	cin>>N>>Q;
	
	vector<int> x(N);
	rep(i,N)cin>>x[i];
	set<int> S;
	vector<int> t,p,y;
	rep(i,N){
		if(!S.count(x[i])){
			t.push_back(1);
			p.push_back(x[i]);
			y.push_back(x[i]);
			S.insert(x[i]);
			
		}
		t.push_back(2);
			y.push_back(x[i]);
			p.push_back(0);
			
		
	}
	if(p.size() > Q){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	while(Q!=p.size()){
		p.push_back(1);
		y.push_back(1);
		t.push_back(1);
	}
	rep(i,Q){
		if(t[i]==1)cout<<t[i]<<' '<<p[i]<<' '<<y[i]<<endl;
		else cout<<t[i]<<' '<<y[i]<<endl;
	}
	
	return 0;
}
0