QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#512310 | #9167. Coprime Array | ucup-team3661# | WA | 72ms | 3716kb | C++20 | 653b | 2024-08-10 14:07:20 | 2024-08-10 14:07:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
int s, x;
cin >> s >> x;
if(s % 2 == 1 && x % 2 == 0){
cout << 3 << endl;
for(int i = -(1<<20); i <= (1<<20); ++i){
if(gcd(abs(i), abs(x)) != 1) continue;
if(s-i-i > 1000000000) continue;
if(gcd(abs(s-i-i), abs(x)) == 1){
cout << i << ' ' << i << ' ' << s-i-i << endl;
break;
}
}
}else{
cout << 2 << endl;
for(int i = -(1<<20); i <= (1<<20); ++i){
if(gcd(abs(i), abs(x)) != 1) continue;
if(s-i > 1000000000) continue;
if(gcd(abs(s-i), abs(x)) == 1){
cout << i << ' ' << s-i << endl;
break;
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
9 6
output:
3 -1048573 -1048573 2097155
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
14 34
output:
2 -1048575 1048589
result:
ok Correct
Test #3:
score: 0
Accepted
time: 72ms
memory: 3564kb
input:
1000000000 223092870
output:
2 29 999999971
result:
ok Correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 1000000000
output:
2 -1048571 1048573
result:
ok Correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
649557664 933437700
output:
2 -1048573 650606237
result:
ok Correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
33396678 777360870
output:
2 -1048573 34445251
result:
ok Correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
48205845 903124530
output:
3 -1048573 -1048573 50302991
result:
ok Correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
251037078 505905400
output:
2 -1048573 252085651
result:
ok Correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
30022920 172746860
output:
2 -1048573 31071493
result:
ok Correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
63639298 808058790
output:
2 -1048573 64687871
result:
ok Correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
76579017 362768406
output:
3 -1048573 -1048573 78676163
result:
ok Correct
Test #12:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
40423669 121437778
output:
3 -1048573 -1048573 42520815
result:
ok Correct
Test #13:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
449277309 720915195
output:
2 -1048573 450325882
result:
ok Correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
81665969 919836918
output:
3 -1048573 -1048573 83763115
result:
ok Correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
470578680 280387800
output:
2 -1048573 471627253
result:
ok Correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
58450340 803305503
output:
2 -1048574 59498914
result:
ok Correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
125896113 323676210
output:
3 -1048573 -1048573 127993259
result:
ok Correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
381905348 434752500
output:
2 -1048571 382953919
result:
ok Correct
Test #19:
score: -100
Wrong Answer
time: 0ms
memory: 3704kb
input:
78916498 653897673
output:
2 -1048576 79965074
result:
wrong answer Jury's answer is better than participant's