Submission #134056

#TimeUsernameProblemLanguageResultExecution timeMemory
134056junodeveloperDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int i; set<pair<long long,int> > st long long sum=0; st.insert({0,0}); for(i=0;i<w.size();i++) { sum+=w[i]; auto it=st.lower_bound(sum-u); if(it!=st.end()) { if(it->first<=sum-l) { vector<int> ans; for(int j=it->second+1;j<=i;j++) ans.push_back(w[j]); return ans; } } st.insert({sum,i}); } return vector<int>(0); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:2: error: expected initializer before 'long'
  long long sum=0;
  ^~~~
molecules.cpp:8:2: error: 'st' was not declared in this scope
  st.insert({0,0});
  ^~
molecules.cpp:9:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<w.size();i++) {
          ~^~~~~~~~~
molecules.cpp:10:3: error: 'sum' was not declared in this scope
   sum+=w[i];
   ^~~