# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
251325 | 2020-07-20T19:48:46 Z | Bruteforceman | Lutrija (COCI19_lutrija) | C++11 | 2000 ms | 256 KB |
#include <bits/stdc++.h> using namespace std; bool isPrime(long long x) { if(x <= 1) return false; for(int i = 2; 1LL * i * i <= x; i++) { if(x % i == 0) { return false; } } return true; } void good(vector <long long> v) { for(auto i : v) if(!isPrime(i)) return ; for(int i = 1; i < v.size(); i++) if(!isPrime(abs(v[i] - v[i - 1]))) { return ; } cout << v.size() << endl; for(auto i : v) { cout << i << " "; } cout << endl; exit(0); } vector <long long> can; vector <long long> now; long long A, B; void solve() { vector <long long> check = now; check.insert(check.begin(), A); check.insert(check.end(), B); good(check); for(auto i : can) { if(find(now.begin(), now.end(), i) == now.end()) { now.push_back(i); solve(); now.pop_back( ); } } } int main() { cin >> A >> B; can = vector <long long> ({2LL, A + 2, A - 2, B + 2, B - 2}); solve(); cout << -1 << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2080 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2076 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2070 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2078 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |