# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
339015 | 2020-12-24T11:28:18 Z | A_D | Lutrija (COCI19_lutrija) | C++14 | 3 ms | 2668 KB |
#include <bits/stdc++.h> #define ll long long #define F first #define S second using namespace std; const ll N=1e3+10; const ll M=1e6+110; vector<int> p; bool b[M]; int sz; bool ok(ll v) { for(ll i=2;i*i<=v;i++){ if(v%i==0)return 0; } return 1; } void sev() { for(int i=2;i<=1e6;i++){ if(b[i]==0){ p.push_back(i); sz++; for(int j=i*i;j<=1e7;j+=i){ b[j]=1; } } } } main() { sev(); ll a,b,q; q=1; while(q--){ cin>>a>>b; if(ok(abs(a-b))){ cout<<2<<endl; cout<<a<<" "<<b<<endl; } if(abs(a-b)%2==0){ cout<<-1; return 0; } for(int i=0;i<min(2000,sz);i++){ ll v=abs(a-p[i]); v+=abs(b-p[i]); if(ok(v)){ cout<<3<<endl; cout<<a<<" "<<p[i]<<" "<<b<<endl; return 0; } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |