# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
339022 | 2020-12-24T11:41:12 Z | A_D | Lutrija (COCI19_lutrija) | C++14 | 117 ms | 18700 KB |
#include <bits/stdc++.h> #define ll long long #define int long long #define F first #define S second using namespace std; const ll N=1e3+10; const ll M=1e7+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(ll i=2;i<=1e7;i++){ if(b[i]==0){ p.push_back(i); sz++; for(ll 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((ll)10000,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; } } cout<<-1; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 111 ms | 18388 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 111 ms | 18392 KB | Output is correct |
2 | Incorrect | 110 ms | 18520 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 111 ms | 18392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 112 ms | 18388 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 18700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 117 ms | 18516 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 113 ms | 18468 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 115 ms | 18456 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 18392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 18556 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |