Submission #199482

#TimeUsernameProblemLanguageResultExecution timeMemory
19948244442Lutrija (COCI19_lutrija)C++11
70 / 70
202 ms380 KiB
#include <bits/stdc++.h> using namespace std; long long a,b,am2,ap2,bm2,bp2; bool pr(long long n){ for(long long i=2;i*i<=n;i++){ if(!(n%i)) return 0; // cout<<"ok"; } return 1; } int main (){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>a>>b; if(pr(a-2)){ am2=1; } if(pr(a+2)){ ap2=1; } if(!am2 and !ap2){ cout<<-1; return 0; } if(pr(b-2)){ bm2=1; } if(pr(b+2)){ bp2=1; } if(!am2 and !ap2){ cout<<-1; return 0; } if(a==2){ if(bm2){ cout<<2<<endl<<2<<" "<<b; } else{ cout<<3<<endl<<2<<" "<<b+2<<" "<<b; } } else if(b==2){ if(bm2){ cout<<2<<endl<<a<<" "<<2; } else{ cout<<3<<endl<<a<<" "<<a+2<<" "<<2; } } else if(ap2 and bp2){ cout<<5<<endl<<a<<" "<<a+2<<" "<<2<<" "<<b+2<<" "<<b; } else if(am2 and bp2){ cout<<4<<endl<<a<<" "<<2<<" "<<b+2<<" "<<b; } else if(ap2 and bm2){ cout<<4<<endl<<a<<" "<<a+2<<" "<<2<<" "<<b; } else if(am2 and bm2){ cout<<3<<endl<<a<<" "<<2<<" "<<b; } 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...