답안 #725448

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
725448 2023-04-17T12:50:33 Z kerem Lutrija (COCI19_lutrija) C++14
63 / 70
157 ms 300 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fir first
#define sec second
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
bool asalMi(int x){
    if(x<=1)
        return false;
    bool c=true;
    for(int i=2;i<sqrt(x);i++){
        if(x%i==0){
            c=false;
            break;
        }
    }
    return c;
}
int32_t main(){
    int x,y;
    cin >> x >> y;
    if(asalMi(abs(x-y))){
        cout << 2 << endl;
        cout << x << " " << y;
        return 0;
    }
    if(x==2 and y==2){
        cout << 3 << endl;
        cout << "2 5 2";
        return 0;
    }
    vector<int> v;
    if(x==2)
        v.pb(2);
    else{
        if(asalMi(x-2))
            v.pb(x),v.pb(2);
        else if(asalMi(x+2))
            v.pb(x),v.pb(x+2),v.pb(2);
        else{
            cout << -1;
            return 0;
        }
    }
    if(y!=2){
        if(asalMi(y-2))
            v.pb(y);
        else if(asalMi(y+2))
            v.pb(y+2),v.pb(y);
        else{
            cout << -1;
            return 0;
        }
    }
    cout << v.size() << endl;
    for(int i=0;i<v.size();i++)
        cout << v[i] << " ";
    return 0;
}

Compilation message

lutrija.cpp: In function 'int32_t main()':
lutrija.cpp:57:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 147 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 300 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 272 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 272 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct