Submission #205707

# Submission time Handle Problem Language Result Execution time Memory
205707 2020-02-29T14:28:17 Z mayhoubsaleh Lutrija (COCI19_lutrija) C++14
14 / 70
182 ms 376 KB
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mid (l+r)/2
#define left 2*i+1
#define righ 2*i+2

using namespace std;
ll a,b;

bool check(ll x){
    for(ll i=2;i*i<=x;i++){
        if(x%i)continue;
        return 0;
    }
    return 1;
}
int main()
{
    cin>>a>>b;
    if(abs(a-b)==2){
        cout<<2<<endl;
        cout<<a<<' '<<b<<endl;
        return 0;
    }
    if(a==2){
        if(check(b-2)){
            cout<<2<<endl;
            cout<<a<<' '<<b<<endl;
            return 0;
        }
        if(check(b+2)){
            cout<<3<<endl;
            cout<<a<<' '<<b+2<<' '<<b<<endl;
            return 0;
        }
    }
    if(b==2){
        if(check(a-2)){
            cout<<2<<endl;
            cout<<a<<' '<<b<<endl;
            return 0;
        }
        if(check(a+2)){
            cout<<3<<endl;
            cout<<a<<' '<<a+2<<' '<<b<<endl;
            return 0;
        }
    }

    if(check(a-2)){
        if(check(b-2)){
            cout<<3<<endl;
            cout<<a<<' '<<2<<' '<<b<<endl;
            return 0;
        }
        if(check(b+2)){
            cout<<4<<endl;
            cout<<a<<' '<<2<<' '<<b+2<<' '<<b<<endl;
            return 0;
        }
    }
    if(check(a+2)){
        if(check(b-2)){
            cout<<4<<endl;
            cout<<a<<' '<<a+2<<' '<<2<<' '<<b<<endl;
        }
        if(check(b+2)){
            cout<<5<<endl;
            cout<<a<<' '<<a+2<<' '<<2<<' '<<b+2<<' '<<b<<endl;
        }
    }
    cout<<-1<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 167 ms 376 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 376 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 182 ms 376 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 135 ms 360 KB Extra information in the output file
2 Halted 0 ms 0 KB -