Submission #485948

#TimeUsernameProblemLanguageResultExecution timeMemory
485948tatoLutrija (COCI19_lutrija)C++14
0 / 70
1 ms288 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; bool check(ll a) { ll x=sqrt(a); for(ll k=2; k<=x; k++) if(a%k==0) return false; return true; } int main() { ll a,b; cin>>a>>b; if(a==2 or b==2) { cout<<3<<'\n'; cout<<a<<' '<<a+b<<' '<<b; return 0; } if(abs(a-b)==2) { cout<<2<<'\n'; cout<<a<<' '<<b; return 0; } if(a==b) { cout<<3<<'\n'; cout<<a<<' '<<a+2<<' '<<b; return 0; } if(a-b>60) { cout<<-1; return 0; } vector <ll> v; for(ll i=min(a,b); i<=61; i+=2) { if(check(i)) { cout<<-1; return 0; } else v.push_back(i); } cout<<v.size()<<'\n'; for(int k=1; k<v.size(); k++) cout<<v[k]<<' '; return 0; }

Compilation message (stderr)

lutrija.cpp: In function 'bool check(long long int)':
lutrija.cpp:10:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   10 |   if(a%k==0)
      |   ^~
lutrija.cpp:13:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   13 |    return true;
      |    ^~~~~~
lutrija.cpp: In function 'int main()':
lutrija.cpp:63:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |  for(int k=1; k<v.size(); k++)
      |               ~^~~~~~~~~
#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...