Submission #963188

# Submission time Handle Problem Language Result Execution time Memory
963188 2024-04-14T16:46:18 Z maxFedorchuk Detecting Molecules (IOI16_molecules) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
#include "molecules.h"
 
vector<int> find_subset(const long long l,const long long u,const vector<long long> w) 
{
    vector < pair < long long ,long long > > mas;
    vector < int > ans;
 
    for(long long i=0;i<w.size();i++)
    {
        mas.push_back({w[i],i});
    }
 
    sort(mas.begin(),mas.end());
 
    for(long long sum=0,ru=0,lu=0;ru<w.size();ru++)
    {
        sum+=mas[ru].first;
 
        while(sum>u)
        {
            sum-=mas[lu].first;
            lu++;
        }
 
        if(sum>=l)
        {
            for(long long j=lu;j<=ru;j++)
            {
                ans.push_back(mas[j].second);
            }
 
            break;
        }
    }
 
    return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:11:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(long long i=0;i<w.size();i++)
      |                       ~^~~~~~~~~
molecules.cpp:18:37: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(long long sum=0,ru=0,lu=0;ru<w.size();ru++)
      |                                   ~~^~~~~~~~~
/usr/bin/ld: /tmp/ccyVnE45.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status