Submission #453653

#TimeUsernameProblemLanguageResultExecution timeMemory
453653ponytailDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
vector<int> find_subset(int l, int u, vector<int> w){ ll n,l,u; cin >> n >> l>>u; pair<ll,ll> w[n]; bool used[n]; ll tot_sum=0; for(int i=0;i<n;i++)cin>>w[i].first; for(int i=0;i<n;i++)w[i].second=i; for(int i=0;i<n;i++)tot_sum+=w[i].first; for(int i=0;i<n;i++)used[i]=false; sort(w,w+n); ll curr_sum=0, pt=0, nani=0; for(int i=0;i<n;i++){ curr_sum+=w[i].first; if(u<curr_sum){ curr_sum-=w[i].first; pt=i; break; } used[i]=true; nani++; if(l<=curr_sum&&curr_sum<=u){ vector<int> ans; for(int j=0;j<n;j++){ if(used[j]) ans.push_back(w[j].second); } return ans; } } for(int i=0;i<min(n-pt,pt);i++){ curr_sum-=w[i].first; used[i]=false; curr_sum+=w[n-i-1].first; used[n-i-1]=true; if(l<=curr_sum&&curr_sum<=u){ break; } } if(l<=curr_sum&&curr_sum<=u){ vector<int> ans; for(int j=0;j<n;j++){ if(used[j]) ans.push_back(w[j].second); } return ans; } else{ return {}; } }

Compilation message (stderr)

molecules.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> find_subset(int l, int u, vector<int> w){
      | ^~~~~~