Submission #1114576

# Submission time Handle Problem Language Result Execution time Memory
1114576 2024-11-19T08:12:06 Z lftroq Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include "molecules.h"

using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
    sort(w.begin(),w.end());
    long long s=0;
    for(int i=0,j=0;i<(int)w.size();i++)
    {
        s+=w[i];
        while(s>u) s-=w[j++];
        if(s>=l)
        {
            vector<int> ans;
            for(int k=j;k<=i;k++) ans.push_back(k);
            return ans;
        }
    }
    return {};
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |     sort(w.begin(),w.end());
      |     ^~~~
      |     short