Submission #258713

#TimeUsernameProblemLanguageResultExecution timeMemory
258713itiamLutrija (COCI19_lutrija)C++11
56 / 70
192 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const char r=' '; const char en='\n'; int prosti(ll a){ for (ll i=2;i*i<=a;i++){ if (a%i==0) return 0; } return 1; } int main(){ ll a,b; cin >> a >> b; if (a==2){ if (prosti(b+2)){ cout << 3 << en << a << r << b+2 << r<< b; return 0; } if (prosti(b-2)){ cout << 2 << en << a << r << b; return 0; } cout << -1; return 0; } if (b==2){ if (prosti(a+2)){ cout << 3 << en << a << r << a+2 << r<< b; return 0; } if (prosti(a-2)){ cout << 2 << en << a << r << b; return 0; } cout << -1; return 0; } if (prosti(a+2)){ if (prosti(b+2)){ cout << 5 << en << a << r << a+2 << r << 2 << r<< b+2 << r<< b; return 0; } if (prosti(b-2)){ cout << 4 << en << a << r << a+2 << r << 2 << r<< b; return 0; } cout << -1; return 0; } if (prosti(a-2)){ if (prosti(b+2)){ cout << 4 << en << a << r << 2 << r<< b+2 << r<< b; return 0; } if (prosti(b-2)){ cout << 2 << en << a << r << 2 << r<< b; return 0; } 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...