Submission #725440

# Submission time Handle Problem Language Result Execution time Memory
725440 2023-04-17T12:46:24 Z kerem Lutrija (COCI19_lutrija) C++14
63 / 70
161 ms 284 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){
    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:55: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]
   55 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
# 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 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 147 ms 272 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 147 ms 284 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 161 ms 276 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 284 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct