题解:CF2247B Yet Another Constructive
shimizu_kiouka · · 题解
题解:CF2247B Yet Another Constructive 题解。
构造一个长为
我们可以用贪心解决此题。
由于序列中都是正整数,则
对于其他可行的情况,首先先往序列中添加
那么这题就解决了。
//coder:shimizu_kiouka
//problem:#CF2247B
//2026/07/18
//And in that light,I find the deliverance.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t;
ll n,k,m;
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>t;
while(t--){
ll a[303030];
ll cnt=0;
cin>>n>>k>>m;
if(k>m){
cout<<"NO\n";
continue;
}
cout<<"YES\n";
for(int i=1;i<k;i++){
a[++cnt]=1;
}
a[++cnt]=m-k+1;
while(cnt<=n){
a[++cnt]=1;
}
for(int i=1;i<cnt;i++){
cout<<a[i]<<' ';
}
cout<<'\n';
}
}