Submission #596527

# Submission time Handle Problem Language Result Execution time Memory
596527 2022-07-14T19:55:30 Z Hussein3600 Lutrija (COCI19_lutrija) C++14
0 / 70
9 ms 1568 KB
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int N=1e6 ;
vector<bool>vis(N+9) ;
vector<ll>p ;
vector<pair<ll,ll> >dif;
ll last=2;
int main()
{
    for(int i=2;i<=N;i++)
    {
        if(!vis[i])
        {
            for(int j=i;j<=N;j+=i)
            {
                vis[j]=true;
            }
            p.push_back(i) ;
        }
    }
    //cout<<p.size()<<endl;
    ll a , b ;
    cin >> a >> b ;
    if(abs(a-b)==2)
    {
        cout<<2<<endl<<a<<" "<<b<<endl;
    }
    else{
       bool ok=true;
       for(int i=0;i<p.size();i++)
       {
           if((a+b)%p[i]==0&&p[i]!=a+b)ok=false ;
       }
       if(ok)cout<<3<<endl<<a<<" "<<a+b<<" "<<b<<endl;
       else cout<<-1<<endl;
    }
}

Compilation message

lutrija.cpp: In function 'int main()':
lutrija.cpp:31:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |        for(int i=0;i<p.size();i++)
      |                    ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1484 KB Output is correct
2 Incorrect 6 ms 1484 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1484 KB Output isn't correct
2 Halted 0 ms 0 KB -