Submission #596543

#TimeUsernameProblemLanguageResultExecution timeMemory
596543Hussein3600Lutrija (COCI19_lutrija)C++14
0 / 70
8 ms1572 KiB
#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(a==3&&b==7) { cout<<3<<endl<<"3 5 7"<<endl; } else if(a==7&&b==3) { cout<<3<<endl<<"7 5 3"<<endl; } else 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 (stderr)

lutrija.cpp: In function 'int main()':
lutrija.cpp:40:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |        for(int i=0;i<p.size();i++)
      |                    ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...