-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCOOK122B.cpp
More file actions
61 lines (55 loc) · 937 Bytes
/
COOK122B.cpp
File metadata and controls
61 lines (55 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
long int n,k,l;
cin>>n>>k>>l;
if(n>l*k)
cout<<"-1"<<endl;
else if((n>=2)&&(k==1))
cout<<"-1"<<endl;
else
{
int m=1;
while(n)
{
if(m==k+1)
m=1;
cout<<m<<" ";
m++;
n--;
}
cout<<endl;
}
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin >> t;
while(t--){
double n, k, l;
cin >> n >> k >> l;
ll y = ceil(n/k);
if(y > l || (k == 1 && n > 1)){
cout<< -1 <<endl;
}else{
ll* arr = new ll[(ll)k];
memset(arr, 0, sizeof(arr));
ll i = 0, p = (ll)n;
while(i < p){
ll x = (i%(ll)k);
cout << x+1 << " ";
i++;
}
cout << endl;
}
}
}