QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226046#3132. The League of Sequence DesignersAbtahi#WA 1ms3460kbC++171.9kb2023-10-25 15:02:242023-10-25 15:02:25

Judging History

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

  • [2023-10-25 15:02:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3460kb
  • [2023-10-25 15:02:24]
  • 提交

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){

                        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;

       }
    }
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3460kb

input:

3
8 3
612 7
4 2019

output:

3
-8 -8 -8 
7
-612 -612 -612 -612 -612 -612 -612 
-1

result:

wrong answer  (test case 1)