# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
814762 |
2023-08-08T09:42:07 Z |
tlnk07 |
Lutrija (COCI19_lutrija) |
C++17 |
|
140 ms |
304 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
long long x, y;
bool check(int x)
{
for(int i = 2; i * i <= x; ++i) if(x % i == 0) return 0;
return 1;
}
signed main()
{
cin >> x >> y;
if(x == 2 && y == 2) cout << "3\n2 5 2";
else if(x == 3 && y == 7) cout << "3\n3 5 7";
else if(x == 7 && y == 3) cout << "3\n7 5 3";
else if(abs(x - y) == 2) cout << "2\n" << x << " " << y;
else if(x == 2 || y == 2)
{
if(check(max(x, y) + 2)) cout << "3\n" << x << " " << max(x, y) + 2 << " " << y;
else if(check(max(x, y) - 2)) cout << "3\n" << x << " " << max(x, y) - 2 << " " << y;
else cout << -1;
}
else if(check(x + 2) && check(y + 2)) cout << "5\n" << x << ' ' << x + 2 << " 2 " << y + 2 << " " << y;
else if(check(x - 2) && check(y - 2)) cout << "3\n" << x << " 2 " << y << "\n";
else if(check(x - 2) && check(y + 2)) cout << "4\n" << x << " 2 " << y + 2 << " " << y;
else if(check(x + 2) && check(y - 2)) cout << "4\n" << x << " " << x + 2 << " 2 " << y;
else cout << -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
129 ms |
272 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
127 ms |
288 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
140 ms |
276 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
103 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
304 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |