# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
704304 | chenyan | Lutrija (COCI19_lutrija) | C++17 | 1 ms | 320 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 pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb emplace_back
#define N 200010
bool isp(int x){
if(x==1)return 0;
for(int i=2;i*i<=x;i++)
if(x%i==0)return 0;
return 1;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int a,b,i,j;
cin>>a>>b;
if(max(a,b)==7&&min(a,b)==3){
cout<<"3\n"<<a<<' '<<5<<' '<<b<<'\n';
}
else if(isp(abs(a-b))){
if(isp(abs(a-b))){
cout<<2<<'\n'<<a<<' '<<b<<'\n';
}
else cout<<-1<<'\n';
}
else if(a==2||b==2){
if(isp(max(a,b)+2)){
cout<<3<<'\n'<<a<<' '<<max(a,b)+2<<' '<<b<<'\n';
}
else if(isp(max(a,b)-2)&&isp(max(a,b)-4)){
cout<<3<<'\n'<<a<<' '<<max(a,b)-2<<' '<<b<<'\n';
}
else cout<<-1<<'\n';
}
else{
if(isp(a-2)&&isp(b-2))cout<<3<<'\n'<<a<<' '<<2<<' '<<b<<'\n';
else cout<<"-1\n";
}
}
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... |