QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#511971 | #9167. Coprime Array | ucup-team1004# | AC ✓ | 0ms | 3844kb | C++14 | 777b | 2024-08-10 13:08:57 | 2024-10-14 07:51:47 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include"debug.h"
#else
#define debug(...) void()
#endif
#define all(x) (x).begin(),(x).end()
template<class T>
auto ary(T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
using ll=long long;
using ull=unsigned long long;
int s,x;
int main(){
cin>>s>>x;
if(__gcd(s,x)==1)cout<<1<<endl<<s<<endl,exit(0);
mt19937 rnd(time(0));
int V=1e8;
if(s%2==1&&x%2==0){
int a,b,c;
do a=2*(rnd()%V)+1,b=2*(rnd()%V)+1,c=s-a-b;while(__gcd(a,x)>1||__gcd(b,x)>1||__gcd(abs(c),x)>1);
cout<<3<<endl<<a<<' '<<b<<' '<<c<<endl;
exit(0);
}
int a,b;
do a=rnd()%V+1,b=s-a;while(__gcd(a,x)>1||__gcd(abs(b),x)>1);
cout<<2<<endl<<a<<' '<<b<<endl;
return 0;
}
#ifdef DEBUG
#include"debug.hpp"
#endif
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3780kb
input:
9 6
output:
3 15436643 7008335 -22444969
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
14 34
output:
2 77719721 -77719707
result:
ok Correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
1000000000 223092870
output:
2 77719721 922280279
result:
ok Correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
2 1000000000
output:
2 77719721 -77719719
result:
ok Correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
649557664 933437700
output:
2 77719721 571837943
result:
ok Correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
33396678 777360870
output:
2 77719721 -44323043
result:
ok Correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
48205845 903124530
output:
3 20552627 13248017 14405201
result:
ok Correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
251037078 505905400
output:
2 77719721 173317357
result:
ok Correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
30022920 172746860
output:
2 77719721 -47696801
result:
ok Correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
63639298 808058790
output:
2 12858101 50781197
result:
ok Correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
76579017 362768406
output:
3 11013775 129038461 -63473219
result:
ok Correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
40423669 121437778
output:
3 15436643 7008335 17978691
result:
ok Correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
449277309 720915195
output:
2 77719721 371557588
result:
ok Correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
81665969 919836918
output:
3 20552627 13248017 47865325
result:
ok Correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
470578680 280387800
output:
2 77719721 392858959
result:
ok Correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
58450340 803305503
output:
2 25275262 33175078
result:
ok Correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
125896113 323676210
output:
3 20552627 13248017 92095469
result:
ok Correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
381905348 434752500
output:
2 93484057 288421291
result:
ok Correct
Test #19:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
78916498 653897673
output:
1 78916498
result:
ok Correct
Test #20:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
35787885 270845190
output:
3 20552627 13248017 1987241
result:
ok Correct
Extra Test:
score: 0
Extra Test Passed