QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#226037 | #3132. The League of Sequence Designers | Abtahi# | WA | 1ms | 3460kb | C++17 | 1.8kb | 2023-10-25 14:59:19 | 2023-10-25 14:59:19 |
Judging History
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){
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:
-8 -8 -8 -612 -612 -612 -612 -612 -612 -612 -1
result:
wrong answer (test case 1)