# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725449 | kerem | Lutrija (COCI19_lutrija) | C++14 | 153 ms | 280 KiB |
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;
#define int long long
#define pb push_back
#define fir first
#define sec second
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
bool asalMi(int x){
if(x<=1)
return false;
bool c=true;
for(int i=2;i<=sqrt(x);i++){
if(x%i==0){
c=false;
break;
}
}
return c;
}
int32_t main(){
int x,y;
cin >> x >> y;
if(asalMi(abs(x-y))){
cout << 2 << endl;
cout << x << " " << y;
return 0;
}
if(x==2 and y==2){
cout << 3 << endl;
cout << "2 5 2";
return 0;
}
vector<int> v;
if(x==2)
v.pb(2);
else{
if(asalMi(x-2))
v.pb(x),v.pb(2);
else if(asalMi(x+2))
v.pb(x),v.pb(x+2),v.pb(2);
else{
cout << -1;
return 0;
}
}
if(y!=2){
if(asalMi(y-2))
v.pb(y);
else if(asalMi(y+2))
v.pb(y+2),v.pb(y);
else{
cout << -1;
return 0;
}
}
cout << v.size() << endl;
for(int i=0;i<v.size();i++)
cout << v[i] << " ";
return 0;
}
Compilation message (stderr)
# | 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... |