Submission #205708

#TimeUsernameProblemLanguageResultExecution timeMemory
205708mayhoubsalehLutrija (COCI19_lutrija)C++14
14 / 70
181 ms504 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define mid (l+r)/2 #define left 2*i+1 #define righ 2*i+2 using namespace std; ll a,b; bool check(ll x){ if(x<=1)return 0; for(ll i=2;i*i<=x;i++){ if(x%i)continue; return 0; } return 1; } int main() { cin>>a>>b; if(abs(a-b)==2){ cout<<2<<endl; cout<<a<<' '<<b<<endl; return 0; } if(a==2){ if(check(b-2)){ cout<<2<<endl; cout<<a<<' '<<b<<endl; return 0; } if(check(b+2)){ cout<<3<<endl; cout<<a<<' '<<b+2<<' '<<b<<endl; return 0; } } if(b==2){ if(check(a-2)){ cout<<2<<endl; cout<<a<<' '<<b<<endl; return 0; } if(check(a+2)){ cout<<3<<endl; cout<<a<<' '<<a+2<<' '<<b<<endl; return 0; } } if(check(a-2)){ if(check(b-2)){ cout<<3<<endl; cout<<a<<' '<<2<<' '<<b<<endl; return 0; } if(check(b+2)){ cout<<4<<endl; cout<<a<<' '<<2<<' '<<b+2<<' '<<b<<endl; return 0; } } if(check(a+2)){ if(check(b-2)){ cout<<4<<endl; cout<<a<<' '<<a+2<<' '<<2<<' '<<b<<endl; } if(check(b+2)){ cout<<5<<endl; cout<<a<<' '<<a+2<<' '<<2<<' '<<b+2<<' '<<b<<endl; } } 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...