답안 #258713

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
258713 2020-08-06T12:09:10 Z itiam Lutrija (COCI19_lutrija) C++11
56 / 70
192 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const char r=' ';
const char en='\n';

int prosti(ll a){
    for (ll i=2;i*i<=a;i++){
        if (a%i==0) return 0;
    }
    return 1;
}

int main(){
    ll a,b;
    cin >> a >> b;

    if (a==2){
        if (prosti(b+2)){
            cout << 3 << en << a << r << b+2 << r<< b;
            return 0;
        }
        if (prosti(b-2)){
            cout << 2 << en << a << r << b;
            return 0;
        }
        cout << -1;
        return 0;
    }
    if (b==2){
        if (prosti(a+2)){
            cout << 3 << en << a << r << a+2 << r<< b;
            return 0;
        }
        if (prosti(a-2)){
            cout << 2 << en << a << r << b;
            return 0;
        }
        cout << -1;
        return 0;
    }
    if (prosti(a+2)){
        if (prosti(b+2)){
            cout << 5 << en << a << r << a+2 << r << 2 << r<< b+2 << r<< b;
            return 0;
        }
        if (prosti(b-2)){
            cout << 4 << en << a << r << a+2 << r << 2 << r<< b;
            return 0;
        }
        cout << -1;
        return 0;
    }
    if (prosti(a-2)){
        if (prosti(b+2)){
            cout << 4 << en << a << r << 2 << r<< b+2 << r<< b;
            return 0;
        }
        if (prosti(b-2)){
            cout << 2 << en << a << r << 2 << r<< b;
            return 0;
        }
        cout << -1;
        return 0;
    }
    cout << -1;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 159 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 192 ms 360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 140 ms 368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 174 ms 380 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 127 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 125 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 45 ms 256 KB Output is correct