# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
199475 |
2020-02-01T14:03:43 Z |
SamAnd |
Lutrija (COCI19_lutrija) |
C++17 |
|
203 ms |
376 KB |
#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
lutrija.cpp: In function 'bool stg(const std::vector<long long int>&)':
lutrija.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < v.size() - 1; ++i)
~~^~~~~~~~~~~~~~
lutrija.cpp: In function 'int main()':
lutrija.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld", &a, &b);
~~~~~^~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
348 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
157 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
169 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
199 ms |
356 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
203 ms |
356 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |