Submission #814852

#TimeUsernameProblemLanguageResultExecution timeMemory
814852Tunglam07Lutrija (COCI19_lutrija)C++17
42 / 70
140 ms340 KiB
#include <bits/stdc++.h> using namespace std; vector<long long> ans; bool isprime(long long x) { if(x==1) { return false; } for(int i=2;i<=sqrt(x);i++) { if(x%i==0) { return false; } } return true; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long a,b; cin >> a >> b; if(a==2) { ans = {2}; } else { if(isprime(a-2)) { ans = {a,2}; } else if(isprime(a+2)) { ans = {a,a+2,2}; } else { cout << -1 << endl; return 0; } } if(b!=2) { if(isprime(b-2)) { ans.push_back(b); } else if(isprime(b+2)) { ans.push_back(b+2); ans.push_back(b); } else { cout << -1 << endl; return 0; } } cout << ans.size() << endl; for(int i : ans) { cout << i << " "; } }
#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...