| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1338303 | neptunns | Lutrija (COCI19_lutrija) | C++20 | 57 ms | 432 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define maxn 100005
#define mi LLONG_MIN
#define ma LLONG_MAX
#define mod 1000000007
#define pb push_back
#define S second
#define F first
int a, b;
bool ans = 0;
bool isp(int x) {
if (x < 2) return false;
for (int i = 2; i * i <= x; i++) {
if (x % i == 0) return false;
}
return true;
}
vector<int> bfs() {
vector<int> v;
v.pb(a);
if (a != 2) {
if (isp(a - 2)) {
v.pb(2);
} else if (isp(a + 2)) {
v.pb(a + 2);
v.pb(2);
} else {
return v;
}
}
if (isp(b - 2)) {
v.pb(b);
} else if (isp(b + 2)) {
v.pb(b + 2);
v.pb(b);
} else {
return v;
}
ans = 1;
return v;
}
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b;
vector<int> answ = bfs();
if (ans) {
cout << answ.size() << endl;
for (auto it : answ) {
cout << it << " ";
}
} else {
cout << -1;
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
