Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define ll long long
- #define Add_Speed ios_base::sync_with_stdio(0);cin.tie(NULL);
- #define pb push_back
- #define mp make_pair
- #define f first
- #define sz size()
- #define s second
- #define pii pair<int, int>
- #define all(s) s.begin(), s.end()
- #define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
- #define inf INT_MAX
- #define int ll
- using namespace std;
- const int maxn = 1e5 + 100;
- const int mod = (int)1e9 + 7;
- const int maxlog = (int)20;
- const int P = mod;
- main () {
- Add_Speed;
- file("B");
- int tt;
- cin >> tt;
- while(tt--){
- int n;
- ll a1;
- cin >> n >> a1;
- ll val = n * (1ll << (n - 1)) + 1;
- //cout << (1ll << (n - 1)) << endl;
- if(n == 1){
- cout << a1 << endl;
- continue;
- }
- if(a1 % val != 0){
- cout << "-1\n";
- continue;
- }
- ll dif;
- if(n == 2) dif = 4;
- if(n == 3) dif = 6;
- else dif = n * 1ll * (1ll << (n - 2));
- dif *= a1 / val;
- cout << a1 << " ";
- for(int i = 2; i <= n; i++){
- ll x = a1, ans = x - dif;
- cout << ans << " ";
- a1 = ans;
- dif /= 2;
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement