This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const char r=' ';
const char en='\n';
int prosti(ll a){
if(a<=1) return 0;
for (ll i=2;i*i<=a;i++){
if (a%i==0) return 0;
}
return 1;
}
int main(){
ll a,b;
cin >> a >> b;
if (a==2){
if (prosti(b+2)){
cout << 3 << en << a << r << b+2 << r<< b;
return 0;
}
if (prosti(b-2)){
cout << 2 << en << a << r << b;
return 0;
}
cout << -1;
return 0;
}
if (b==2){
if (prosti(a+2)){
cout << 3 << en << a << r << a+2 << r<< b;
return 0;
}
if (prosti(a-2)){
cout << 2 << en << a << r << b;
return 0;
}
cout << -1;
return 0;
}
if (prosti(a+2)){
if (prosti(b+2)){
cout << 5 << en << a << r << a+2 << r << 2 << r<< b+2 << r<< b;
return 0;
}
if (prosti(b-2)){
cout << 4 << en << a << r << a+2 << r << 2 << r<< b;
return 0;
}
cout << -1;
return 0;
}
if (prosti(a-2)){
if (prosti(b+2)){
cout << 4 << en << a << r << 2 << r<< b+2 << r<< b;
return 0;
}
if (prosti(b-2)){
cout << 3 << en << a << r << 2 << r<< b;
return 0;
}
cout << -1;
return 0;
}
cout << -1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |