Advertisement
Ankit_132

A

Aug 26th, 2023
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll     long long
  5. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  6. #define pb     push_back
  7.  
  8. int main()
  9. {
  10.     _test
  11.     {
  12.         int n, x, y;
  13.         cin>>x>>y>>n;
  14.  
  15.         vector<int> a(n);
  16.  
  17.         a[n-1] = y;
  18.  
  19.         for(int i=n-2, j=1; i>=0; i--)
  20.             a[i] = a[i+1]-(j++);
  21.  
  22.         if(a[0] < x)
  23.         {
  24.             cout<<-1<<"\n";
  25.             continue;
  26.         }
  27.  
  28.         a[0] = x;
  29.  
  30.         for(auto e: a)
  31.             cout<<e<<" ";
  32.         cout<<"\n";
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement