Submission #485963

#TimeUsernameProblemLanguageResultExecution timeMemory
485963tatoLutrija (COCI19_lutrija)C++14
7 / 70
1 ms204 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; bool check(ll a) { ll x=sqrt(a); for(ll k=2; k<=x; k++) if(a%k==0) return false; return true; } int main() { ll a,b; cin>>a>>b; if(check(a-2) and check(b-2) and a>3 and b>3) { cout<<3<<'\n'; cout<<a<<' '<<2<<' '<<b; return 0; } if(abs(a-b)==2) { cout<<2<<'\n'; cout<<a<<' '<<b; return 0; } if(abs(a-b)==1) { if(a>b) { if(check(b+3)) if(check(a+2)) { cout<<2<<'\n'; cout<<a<<' '<<a+2<<' '<<b; return 0; } if(a>4) if(check(b-2)) if(check(a-3)) { cout<<2<<'\n'; cout<<a<<' '<<a-3<<' '<<b; return 0; } } else { if(check(a+3)) if(check(b+2)) { cout<<2<<'\n'; cout<<a<<' '<<b+2<<' '<<b; return 0; } if(b>4) if(check(a-2)) if(check(b-3)) { cout<<2<<'\n'; cout<<a<<' '<<b-3<<' '<<b; return 0; } } cout<<-1; return 0; } if(a==2) { if(check(b+2)) { cout<<3<<'\n'; cout<<a<<' '<<b+2<<' '<<b; return 0; } else if(check(b-2) and (b-2)>1) { cout<<3<<'\n'; cout<<a<<' '<<b-2<<' '<<b; return 0; } else { cout<<-1; return 0; } } if(b==2) { if(check(a+2)) { cout<<3<<'\n'; cout<<a<<' '<<a+2<<' '<<b; return 0; } else if(check(a-2) and (a-2)>1) { cout<<3<<'\n'; cout<<a<<' '<<a-2<<' '<<b; } else { cout<<-1; return 0; } } cout<<-1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...