Saleh127

Cookoff 9/20

Sep 20th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. test
  11. {
  12. ll a[10005]={0},c,d,e,i,j,k,l,n;
  13. cin>>n>>k>>l;
  14. if(n>(k*l))
  15. {
  16. cout<<-1<<endl;
  17. continue;
  18. }
  19. if(k==1 && n>1)
  20. {
  21. cout<<-1<<endl;
  22. continue;
  23. }
  24. for(i=1;i<=k;i++)
  25. {
  26. a[i]=l;
  27. }
  28. d=1;
  29. j=0;
  30. while(1)
  31. {
  32. if(j==n) break;
  33. if(d>k)
  34. {
  35. d=1;
  36. }
  37.  
  38. if(a[d]>0)
  39. {
  40. if(j==n-1) cout<<d<<endl;
  41. else cout<<d<<" ";
  42. a[d]--;
  43. d++;
  44. j++;
  45. }
  46. else if(a[d]==0)
  47. {
  48. d++;
  49. }
  50. }
  51.  
  52. }
  53. return 0;
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment