Submission #704756

# Submission time Handle Problem Language Result Execution time Memory
704756 2023-03-03T00:52:48 Z pcc Lutrija (COCI19_lutrija) C++14
7 / 70
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
bool isp(ll k){
    if(k == 1)return true;
    for(ll i = 2;i*i<=k;i++){
        if(k%i == 0)return false;
    }
    return true;
}
int main(){
    ll a,b;
    cin>>a>>b;
    vector<ll> ans;
    bool rev = false;
    if(a>b){
        rev = true;
        swap(a,b);
    }
    ans.push_back(a);
    if(a == 2){
        if(isp(b+2))ans = {a,b+2,b};
        else if(isp(b-2))ans = {a,b-2,b};
        else{
            cout<<-1;
            return 0;
        }
    }
    else{
        if(isp(a-2)&&isp(b-2))ans = {a,2,b};
        else if(b-a == 2)ans = {a,b};
        else{
            cout<<-1;
            return 0;
        }
    }
    if(rev)reverse(ans.begin(),ans.end());
    cout<<ans.size()<<'\n';
    for(auto &i:ans)cout<<i<<' ';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 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 -