Submission #735285

# Submission time Handle Problem Language Result Execution time Memory
735285 2023-05-03T20:18:05 Z aykhn Lutrija (COCI19_lutrija) C++14
0 / 70
1 ms 340 KB
#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 - a))
    {
        cout << 2 << endl << x << " " << y << endl;
        return 0;
    }
    if (isPrime(b - 2 - a) && isPrime(b - 2))
    {
        cout << 3 << endl << x << " " << b - 2 << " " << y << endl;
        return 0;
    }
    if (isPrime(b + 2 - a) && isPrime(b + 2))
    {
        cout << 3 << endl << x << " " << b + 2 << " " << y << endl;
        return 0;
    }

    cout << -1 << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 320 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -