QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#516559 | #9167. Coprime Array | KavenSky | WA | 7ms | 3648kb | C++23 | 844b | 2024-08-12 18:42:00 | 2024-08-12 18:42:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>P;
using ll = long long;
const ll N = 2e5 + 5;
void solve(){
ll s,x;
cin >> s >> x;
if(__gcd(s,x)==1){
cout << 1 << "\n";
cout << s << "\n";
return;
}
for(ll i=x;i<=100000;i++){
if(__gcd(x,i)==1&&__gcd(s-i,x)==1){
cout << 2 << "\n";
cout << i << " " << s-i << "\n";
return;
}
}
for(ll i=1;i<=100000;i++){
if(__gcd(x,i)==1&&__gcd(s-1-i,x)==1){
cout << 3 << "\n";
cout << i << " " << s-i-1 << " " << 1 << "\n";
return;
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
ll T = 1;
//cin >> T;
while (T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3616kb
input:
9 6
output:
3 1 7 1
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
14 34
output:
2 41 -27
result:
ok Correct
Test #3:
score: -100
Wrong Answer
time: 7ms
memory: 3556kb
input:
1000000000 223092870
output:
result:
wrong output format Unexpected end of file - int32 expected