Submission #319326

#TimeUsernameProblemLanguageResultExecution timeMemory
319326gustasonLutrija (COCI19_lutrija)C++14
0 / 70
87 ms388 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; bool isPrime(ll n) { if (n < 2) 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(nullptr); ll A, B; cin >> A >> B; bool ok = 0; if (abs(A - B) == 2) { cout << 2 << "\n" << A << " " << B; ok = 1; } else { if (isPrime(B - 2) && isPrime(abs(A - (B - 2)))) { cout << 3 << "\n" << A << " " << B - 2 << " " << B << "\n"; ok = 1; } else if (isPrime(B + 2) && isPrime(abs(A - (B + 2)))) { cout << 3 << "\n" << A << " " << B + 2 << " " << B << "\n"; ok = 1; } } if (!ok) { cout << -1; } return 0; } //~ check for overflows
#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...