Submission #812690

#TimeUsernameProblemLanguageResultExecution timeMemory
812690elotelo966Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long std::vector<int> find_subset(int l, int u, std::vector<int> w){ vector <pair<ll,ll>> dizi; for(ll i=0;i<w.size();i++){ dizi.push_back({w[i],i}); } sort(dizi.begin(),dizi.end()); ll n=w.size(); ll le=0,r=0; bool stop=false; while(le<=r && r<n){ if(sum+dizi[r].first<l){ sum+=dizi[r].first; r++; } else if(sum+dizi[r].first>=l && sum+dizi[r].first<=u){ stop=true; break; } else{ sum-=dizi[le].first; le++; } } vector <ll> cev; if(stop){ for(int i=le;i<=r;i++){ cev.push_back(ger[i].second); } sort(cev.begin(),cev.end()); } return std::vector<int> cev; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(ll i=0;i<w.size();i++){
      |                ~^~~~~~~~~
molecules.cpp:16:12: error: 'sum' was not declared in this scope
   16 |         if(sum+dizi[r].first<l){
      |            ^~~
molecules.cpp:33:23: error: 'ger' was not declared in this scope
   33 |         cev.push_back(ger[i].second);
      |                       ^~~
molecules.cpp:37:29: error: expected primary-expression before 'cev'
   37 |     return std::vector<int> cev;
      |                             ^~~
molecules.cpp:37:28: error: expected ';' before 'cev'
   37 |     return std::vector<int> cev;
      |                            ^~~~
      |                            ;
molecules.cpp:37:29: warning: statement has no effect [-Wunused-value]
   37 |     return std::vector<int> cev;
      |                             ^~~