Problem E The League of Sequence Designers

 

 

 

 

 

 

 

 

 

#include <bits/stdc++.h>
#define inf 2333333333333333
#define N 1000010
#define p(a) putchar(a)
#define For(i,a,b) for(long long i=a;i<=b;++i)

using namespace std;
long long T,k,L,a,c;

void in(long long &x){
    long long y=1;char c=getchar();x=0;
    while(c<'0'||c>'9'){if(c=='-')y=-1;c=getchar();}
    while(c<='9'&&c>='0'){ x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    x*=y;
}
void o(long long x){
    if(x<0){p('-');x=-x;}
    if(x>9)o(x/10);
    p(x%10+'0');
}

signed main(){
    in(T);
    while(T--){
        in(k);in(L);
        if(L>1999){
            o(-1);p('\n');
            continue;
        }
        L=1999;
        For(i,1,3){
            if((k+L*i)%2==0){
                a=(k+L*i)/2;
                c=i;
                break;
            }
        }
        o(L);p('\n');
        o(0);p(' ');o(-c);p(' ');
        For(i,3,L-1) o(a/(L-3)),p(' ');
        o(a%(L-3));p('\n');
    }
    return 0;
}

 

posted @ 2020-07-06 16:24  WeiAR  阅读(244)  评论(0编辑  收藏  举报