Submission #528720

#TimeUsernameProblemLanguageResultExecution timeMemory
528720groshiDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h"
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
map<long long,int> mapka;
vector<int> find_subset(long long l,long long u,vector<int> w)
{
    long long suma=0;
    vector<int> t;
    mapka[0]=-1;
    for(int i=0;i<w.size();i++)
    {
        suma+=w[i];
        mapka[suma]=i;
        auto it=mapka.lower_bound(suma-u);
        if(it==mapka.end())
            continue;
        long long gdzie=it->first;
        if(suma-gdzie>=l && suma-gdzie<=u)
        {
            for(int j=it->second+1;j<=i;j++)
            {
                t.push_back(w[j]);
            }
            break;
        }
    }
    return t;
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(long long int, long long int, std::vector<int>)':
molecules.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<w.size();i++)
      |                 ~^~~~~~~~~
/usr/bin/ld: /tmp/cc30smbJ.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