QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#511962 | #9167. Coprime Array | ucup-team052# | WA | 0ms | 3680kb | C++23 | 594b | 2024-08-10 13:06:12 | 2024-08-10 13:06:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int s, x;
int main() {
cin >> s >> x;
if (__gcd(s, x) == 1) {
cout << 1 << '\n';
cout << s << '\n';
return 0;
}
if (x % 2 == 0 && s % 2 == 1) {
for (int i = 1; ; i += 2) {
if (__gcd(i, x) == 1 && __gcd(i * 2 + s, x) == 1) {
cout << 3 << '\n';
cout << -i << ' ' << -i << ' ' << i * 2 + s << '\n';
return 0;
}
}
}
for (int i = 1; ; i += 2) {
if (__gcd(i, x) == 1 && __gcd(i + s, x) == 1) {
cout << 2 << '\n';
cout << -i << ' ' << i + s << '\n';
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
9 6
output:
3 -1 -1 11
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
14 34
output:
2 -1 15
result:
ok Correct
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
1000000000 223092870
output:
2 -31 1000000031
result:
wrong answer Integer element a[2] equals to 1000000031, violates the range [-10^9, 10^9]