Submission #647197

#TimeUsernameProblemLanguageResultExecution timeMemory
647197tigarDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
vector<ll> find_subset(int l, int u, vector<ll>w)
{
    ll n=w.size();
    sort(w.begin(), w.end());
    vector<ll>result;
    long long sums[n+1];
    sums[0]=(ll)0;
    for(int i=1; i<=n; i++)sums[i]=(ll)w[i-1]+sums[i-1];
    for(int i=1, j=1; i<=n;)
    {
        int sum=sums[i]-sums[j-1];
        if(sum>=l and sum<=u)
        {
            for(int k=j-1; k<i; k++)result.push_back(k);
            break;
        }
        else if(sum<l)i++;
        else if(sum>u)j++;
    }
    return result;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccHG9vod.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