Submission #849752

#TimeUsernameProblemLanguageResultExecution timeMemory
849752chilengamingDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#includee<bits/stdc++.h>
#include "molecules.h"

using namespace std;

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

Compilation message (stderr)

molecules.cpp:1:2: error: invalid preprocessing directive #includee; did you mean #include?
    1 | #includee<bits/stdc++.h>
      |  ^~~~~~~~
      |  include
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i=0;i<w.size();i++)
      |                 ~^~~~~~~~~
molecules.cpp:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(ww.begin(), ww.end());
      |     ^~~~
      |     short
molecules.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i=0;i<ww.size();i++)
      |                  ~^~~~~~~~~~