Submission #596525

#TimeUsernameProblemLanguageResultExecution timeMemory
596525Hussein3600Lutrija (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(abs(a-b)==2)cout<<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<<a<<" "<<a+b<<" "<<b<<endl; else cout<<-1<<endl; } }

Compilation message (stderr)

lutrija.cpp: In function 'int main()':
lutrija.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |        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...