QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#512029 | #9167. Coprime Array | ucup-team956# | WA | 0ms | 3644kb | C++20 | 882b | 2024-08-10 13:19:41 | 2024-08-10 13:19:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define time chrono::system_clock::now().time_since_epoch().count()
mt19937_64 rnd(time);
#define maxn 1000005
#define int long long
int read() {int x;cin>>x;return x;}
void solve() {
int n = read(), s = read();
if(__gcd(n, s) == 1) {
cout << 1 << "\n" << n << "\n";
}
else if(__gcd(n + 1, s) == 1 || __gcd(n - 1, s) == 1) {
cout << 2 << "\n";
if(__gcd(n + 1, s) == 1) cout << n + 1 << " " << -1 << "\n";
else cout << n - 1 << " " << 1 << "\n";
}
else {
cout << 3 << "\n";
cout << n - 2 << " " << 1 << " " << 1 << "\n";
}
}
signed main() {
#ifdef ONLINE_JUDGE
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
#else
//freopen("a.in", "r", stdin);
#endif
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
9 6
output:
3 7 1 1
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
14 34
output:
2 15 -1
result:
ok Correct
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3556kb
input:
1000000000 223092870
output:
3 999999998 1 1
result:
wrong answer Element at position 1 is not coprime to x