QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#226063#3132. The League of Sequence DesignersAbtahi#WA 43ms3640kbC++171.9kb2023-10-25 15:21:192023-10-25 15:21:19

Judging History

你现在查看的是最新测评结果

  • [2023-10-25 15:21:19]
  • 评测
  • 测评结果:WA
  • 用时:43ms
  • 内存:3640kb
  • [2023-10-25 15:21:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef unordered_map<int,int> umap;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define popcount __builtin_popcount
#define case cout<<"Case "<<__testcase-testcase<<": ";
#define endl '\n'

#define INF 1e18

const int N=1000000;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int testcase=1;
    cin>>testcase;
    int __testcase=testcase;
    while(testcase--){
       ll k,l;
       cin>>k>>l;
       if(l>=2000) cout<<-1<<endl;
       else{
//            if(k<=N){
//                cout<<max(1LL,l)<<endl;
//                for(int i=0;i<max(1LL,l);i++) cout<< -k <<' ';
//                cout<<endl;
//                continue;
//            }
            int ok=0;

            for(ll z=1;z<=l;z++){
                    //cout<<z<<endl;
                ll md=k%z;
                for(ll a=z-md;a<N;a+=z){
                    if((a+k)%z) continue;
                    ll b=(a+k)/z;
                    if(b<a and z>=3 and z<=2*b){

                        vector<ll> ans;
                        ans.pb(a);
                        ans.pb(-(a+1));
                        for(int len=0;len<z-3;len++) ans.pb(0);
                        ans.pb(b+1);
                        while(ans.size()<l) ans.pb(-a);

                        cout<<ans.size()<<endl;
                        for(auto i:ans) cout<<i<<' ';
                        cout<<endl;
                        ok=1;
                        break;



                    }
                    if(ok) break;

                }
                if(ok) break;
            }

        if(!ok)cout<<-1<<endl;

       }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 9ms
memory: 3640kb

input:

3
8 3
612 7
4 2019

output:

3
7 -8 6 
7
309 -310 308 -309 -309 -309 -309 
-1

result:

ok  (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 43ms
memory: 3604kb

input:

5
8 1999
612 1999
1 1999
1000000000 1999
7777777 1999

output:

1999
7 -8 6 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 ...

result:

wrong answer  (test case 4)