Submission #939926

#TimeUsernameProblemLanguageResultExecution timeMemory
93992612345678Lutrija (COCI19_lutrija)C++17
7 / 70
141 ms428 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll a, b; vector<ll> ans; bool isprime(ll x) { ll t=sqrt(x); if (x==0||x==1) return 0; if (x==2) return 1; for (ll i=2; i<=t; i++) if (x%i==0) return 0; return 1; } int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>a>>b; if (isprime(abs(b-a))) return cout<<2<<'\n'<<a<<' '<<b, 0; ans.push_back(a); if (isprime((abs(a-2))&&a!=2)||(isprime(a+2)&&a!=2)) ans.push_back(2); else if (a!=2) return cout<<-1, 0; if (isprime(b-2)) ans.push_back(b); else if (isprime(b+2)) ans.push_back(b+2), ans.push_back(b); else return cout<<-1, 0; cout<<ans.size()<<'\n'; for (auto x:ans) cout<<x<<' '; }
#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...