QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#586903 | #9167. Coprime Array | yhddd | AC ✓ | 0ms | 4016kb | C++20 | 1.0kb | 2024-09-24 16:27:35 | 2024-09-24 16:27:35 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define mod 998244353ll
#define pii pair<int,int>
#define fi first
#define se second
#define mems(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define db double
using namespace std;
const int maxn=200010;
const int inf=1e9;
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch-48);ch=getchar();}
return x*f;
}
bool Mbe;
int s,x;
mt19937 rnd(time(0));
void work(){
s=read(),x=read();
if(__gcd(s,x)==1){
printf("1\n%lld\n",s);
return ;
}
if((s&1)&&!(x&1))printf("3\n1 "),s--;
else printf("2\n");
while(1){
int u=rnd()%inf,v=s-u;
if(__gcd(abs(u),x)==1&&__gcd(abs(v),x)==1){
printf("%lld %lld\n",u,v);
return ;
}
}
}
// \
444
bool Med;
int T;
signed main(){
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
// ios::sync_with_stdio(0);
// cin.tie(0);cout.tie(0);
// cerr<<(&Mbe-&Med)/1048576.0<<" MB\n";
T=1;
while(T--)work();
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3944kb
input:
9 6
output:
3 1 550250545 -550250537
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
14 34
output:
2 550250545 -550250531
result:
ok Correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
1000000000 223092870
output:
2 123222311 876777689
result:
ok Correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
2 1000000000
output:
2 123222311 -123222309
result:
ok Correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
649557664 933437700
output:
2 123222311 526335353
result:
ok Correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
33396678 777360870
output:
2 123222311 -89825633
result:
ok Correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
48205845 903124530
output:
3 1 999086023 -950880179
result:
ok Correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
251037078 505905400
output:
2 808602147 -557565069
result:
ok Correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
30022920 172746860
output:
2 123222311 -93199391
result:
ok Correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
63639298 808058790
output:
2 161327321 -97688023
result:
ok Correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
76579017 362768406
output:
3 1 888567793 -811988777
result:
ok Correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
40423669 121437778
output:
3 1 123222311 -82798643
result:
ok Correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
449277309 720915195
output:
2 643678738 -194401429
result:
ok Correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
81665969 919836918
output:
3 1 123222311 -41556343
result:
ok Correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
470578680 280387800
output:
2 123222311 347356369
result:
ok Correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
58450340 803305503
output:
2 643678738 -585228398
result:
ok Correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
125896113 323676210
output:
3 1 365043001 -239146889
result:
ok Correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
381905348 434752500
output:
2 365043001 16862347
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: 3956kb
input:
35787885 270845190
output:
3 1 999086023 -963298139
result:
ok Correct
Extra Test:
score: 0
Extra Test Passed