# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
637240 |
2022-09-01T06:49:45 Z |
iee |
Lutrija (COCI19_lutrija) |
C++17 |
|
304 ms |
340 KB |
// iee
#include <bits/stdc++.h>
#define rep(i, a, b) for (auto i = (a); i <= (b); ++i)
#define per(i, a, b) for (auto i = (a); i >= (b); --i)
#define fi first
#define se second
using ll = long long;
using ull = unsigned long long;
using namespace std;
void work(int);
template <class T> void read(T &x) {
x = 0; int f = 1, ch = getchar();
while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
while (isdigit(ch)) x = x * 10 + (ch - '0'), ch = getchar();
x *= f;
}
int main() {
int TT = 1; // cin >> TT;
rep(CAS, 1, TT)
work(CAS);
return 0;
}
bool isp(ll x) {
if (x <= 1) return 0;
rep(i, 2, x / i) if (x % i == 0) return 0;
return 1;
}
void work(int CASE) {
ll a, b; cin >> a >> b;
if (a != 2 && !isp(a - 2) && !isp(a + 2)) { puts("-1"); return; }
if (b != 2 && !isp(b - 2) && !isp(b + 2)) { puts("-1"); return; }
vector<int> ans;
if (isp(a - 2)) ans.push_back(a);
else if (isp(a + 2)) ans.push_back(a), ans.push_back(a + 2);
ans.push_back(2);
if (isp(b - 2)) ans.push_back(b);
else if (isp(b + 2)) ans.push_back(b + 2), ans.push_back(b);
cout << ans.size() << '\n';
for (int x: ans) cout << x << ' ';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 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 |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 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 |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
288 ms |
280 KB |
Integer parameter [name=arr[4]] equals to -2039078211, violates the range [1, 1000000000000000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
284 ms |
212 KB |
Integer parameter [name=arr[1]] equals to -2145466189, violates the range [1, 1000000000000000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
304 ms |
284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
220 ms |
280 KB |
Integer parameter [name=arr[4]] equals to -2070243847, violates the range [1, 1000000000000000] |
2 |
Halted |
0 ms |
0 KB |
- |