QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#226135 | #3132. The League of Sequence Designers | Abtahi# | WA | 39ms | 3708kb | C++17 | 2.5kb | 2023-10-25 16:32:52 | 2023-10-25 16:32:52 |
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){
// 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<2000;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+1>N) continue;
if(b+1<=a and z>=2){
vector<ll> ans;
for(int len=0;len<z-2;len++) ans.pb(0);
ans.pb(-1);
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;
}
else if(b<a and z>=2 and z+2<2000){
vector<ll> ans;
for(int len=0;len<z-2;len++) ans.pb(0);
ans.pb(-1);
ans.pb(b+1);
ans.pb(-a);
while(ans.size()<l-1) ans.pb(-a);
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: 100
Accepted
time: 6ms
memory: 3648kb
input:
3 8 3 612 7 4 2019
output:
3 -1 10 -10 7 -1 614 -614 -614 -614 -614 -614 -1
result:
ok (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 39ms
memory: 3708kb
input:
5 8 1999 612 1999 1 1999 1000000000 1999 7777777 1999
output:
1999 -1 10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -...
result:
wrong answer (test case 5)