#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
ll a, b;
bool ptest(ll x){
if(x <= 1) return !x;
for(int i = 2; i * i <= x; i++){
if(x % i == 0) return 0;
}
return 1;
}
ll val(ll x){
for(int i = -2; i <= 2; i += 2){
if(ptest(x + i - 2) && ptest(x + i)) return x + i;
}
return 0;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> a >> b;
if(ptest(abs(a - b))){
cout << 2 << endl;
cout << a << " " << b << endl;
}else{
ll x = val(a), y = val(b);
cout << 1 + (x != a) + (x != 2) + (y != 2) + (y != b) << endl;
cout << a << " ";
if(x != a) cout << x << " ";
if(x != 2) cout << 2 << " ";
if(y != b && y != 2) cout << y << " ";
cout << b << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Incorrect |
5 ms |
384 KB |
Integer parameter [name=arr[2]] equals to 0, violates the range [1, 1000000000000000] |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Incorrect |
5 ms |
384 KB |
Integer parameter [name=arr[2]] equals to 0, violates the range [1, 1000000000000000] |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Integer parameter [name=arr[2]] equals to 0, violates the range [1, 1000000000000000] |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Integer parameter [name=arr[2]] equals to 0, violates the range [1, 1000000000000000] |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Integer parameter [name=arr[2]] equals to 0, violates the range [1, 1000000000000000] |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
384 KB |
Integer parameter [name=arr[2]] equals to 0, violates the range [1, 1000000000000000] |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2086 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2089 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2077 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2083 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |