Submission #1267015

#TimeUsernameProblemLanguageResultExecution timeMemory
1267015zagaroDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
vector<int> find_subset(int x, int y, vector<ll> w) { ll l, r, m, n, s, p; bl B; n = w.size(); vector<pair<ll,ll> > vec(n+1); for(int i=1;i<=n;i++)vec[i] = {w[i-1], i-1}; sort(vec.begin(), vec.end()); for(int i=1;i<=n;i++)vec[i].first+=vec[i-1].first; p= -1; for(int i=1;i<=n;i++){ B=false; l=0; r=(n-i)+1; wl(l<r-1){ m = (l+r)/2; s = vec[m+i].first-vec[m].first; if(s>=x && s <= y){B=true;break;} else if(s<x)l=m; else r=m; } if(B){p=i;break;} } vector<int> res; if(B){ for(int i=1;i<=p;i++)res.push_back(vec[m+i].second); } return res; }

Compilation message (stderr)

molecules.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> find_subset(int x, int y, vector<ll> w) {
      | ^~~~~~
molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~