| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 199475 | SamAnd | Lutrija (COCI19_lutrija) | C++17 | 203 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
bool stgg(long long x)
{
if (x <= 1)
return false;
for (long long i = 2; i * i <= x; ++i)
{
if (x % i == 0)
return false;
}
return true;
}
bool stg(const vector<long long>& v)
{
for (int i = 0; i < v.size() - 1; ++i)
{
if (!stgg(v[i]))
return false;
if (!stgg(abs(v[i + 1] - v[i])))
return false;
}
return true;
}
int main()
{
long long a, b;
scanf("%lld%lld", &a, &b);
if (stg({a, b}))
{
printf("2\n%lld %lld\n", a, b);
return 0;
}
if (stg({a, 2, b}))
{
printf("3\n%lld 2 %lld\n", a, b);
return 0;
}
if (a == 2)
{
if (stg({a, b + 2, b}))
{
printf("3\n%lld %lld %lld\n", a, b + 2, b);
return 0;
}
if (stg({a, b - 2, b}))
{
printf("3\n%lld %lld %lld\n", a, b - 2, b);
return 0;
}
}
if (b == 2)
{
if (stg({a, a + 2, b}))
{
printf("3\n%lld %lld %lld\n", a, a + 2, b);
return 0;
}
if (stg({a, a - 2, b}))
{
printf("3\n%lld %lld %lld\n", a, a - 2, b);
return 0;
}
}
printf("-1\n");
return 0;
}
Compilation message (stderr)
| # | 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... | ||||
