Submission #725440

#TimeUsernameProblemLanguageResultExecution timeMemory
725440keremLutrija (COCI19_lutrija)C++14
63 / 70
161 ms284 KiB
#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 (stderr)

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 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...