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>
/*
author: aykhn
5/1/2023
*/
using namespace std;
typedef long long ll;
const int oo = INT_MAX;
const ll ooo = LONG_MAX;
const ll mod = 1e9 + 7;
#define OPT ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define tos to_string
#define infll 0x3F3F3F3F3F3F3F3FLL
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout<<endl;
bool isPrime(ll a)
{
for (ll i = 2; i * i <= a; i++)
{
if (a % i == 0) return false;
}
return true;
}
int main()
{
OPT;
ll a, b;
cin >> a >> b;
ll x = a;
ll y = b;
if (a > b) swap(a, b);
if (b - a == 2)
{
cout << 2 << endl << x << " " << y << endl;
return 0;
}
if (a != 2)
{
cout << -1 << endl;
return 0;
}
if (isPrime(b - 2))
{
cout << 2 << endl << x << " " << y << endl;
return 0;
}
if (isPrime(b + 2))
{
cout << 3 << endl << x << " " << b + 2 << " " << y << endl;
return 0;
}
cout << -1 << endl;
}
# | 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... |