Submission #256874

#TimeUsernameProblemLanguageResultExecution timeMemory
256874dolijanLutrija (COCI19_lutrija)C++14
0 / 70
1 ms384 KiB
#include <bits/stdc++.h> typedef long long ll; #define pb push_back; using namespace std; bool prost(ll n) { if(n==1) return false; for(ll i=2;i*i<=n;i++) { if(n%i==0) return false; } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll a,b; cin>>a>>b; if(a==2) { if(prost(b-2)) { cout<<2<<endl; cout<<2<<" "<<b<<endl; } else if(prost(b+2)) { cout<<3<<endl; cout<<2<<" "<<b+2<<" "<<b<<endl; } else { cout<<-1<<endl; } } else if(a==3) { if(b==5) { cout<<2<<endl; cout<<3<<" "<<5<<endl; } else if(b==7) { cout<<3<<endl; cout<<3<<" "<<5<<" "<<7<<endl; } else { cout<<-1<<endl; } } else { if(abs(a-b)==2) { cout<<2<<endl; cout<<a<<" "<<b<<endl; } else { cout<<-1<<endl; } } 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...