Submission #863317

#TimeUsernameProblemLanguageResultExecution timeMemory
86331720163070Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;

#define int long long

struct node
{
	int id,mark;
	bool operator < (const node &b)const
	{
		return mark<b.mark;
	}
};

bool cmp(node a,node b)
{
	return a.mark<b.mark;
}

std::vector<int> find_subset(int ll, int rr, std::vector<int> w) {
	int n=w.size();
    vector<node> p(n);
    for(int i=0;i<n;i++)
    {
    	p[i].id=i;
    	p[i].mark=w[i];
	}
	sort(p.begin(),p.end());
	int l=0,r=0;
    int res=p[0].mark;
    vector<bool> st(n+1,0);
    st[0]=1;
    while(l<=r&&l<n&&r<n)
    {
    	if(res<ll) res+=p[++r].mark,st[r]=1;
    	else if(res>rr) res-=p[l++].mark,st[l-1]=0;
    	else
    	{
    		vector<int> t;
    		for(int i=0;i<n;i++)
    		{
    			if(st[i]) t.push_back(p[i].id);
			}
    		return t;
		}
	}
	vector<int> tt;
	return tt;
}

Compilation message (stderr)

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