# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
339009 | 2020-12-24T11:17:57 Z | A_D | Lutrija (COCI19_lutrija) | C++14 | 1780 ms | 98240 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=1e7+110; vector<int> p; bool dp[N][N][2]; int 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<=1e7;i++){ if(b[i]==0){ p.push_back(i); sz++; for(int j=i*i;j<=1e7;j+=i){ b[i]=1; } } } } main() { sev(); ll a,b; 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<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 | Incorrect | 1722 ms | 97956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1780 ms | 97772 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1764 ms | 98020 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1726 ms | 97912 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1712 ms | 98036 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1695 ms | 98096 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1689 ms | 98240 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1689 ms | 98092 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1721 ms | 98040 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1700 ms | 98144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |