Submission #134983

# Submission time Handle Problem Language Result Execution time Memory
134983 2019-07-23T13:45:52 Z antimirage Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include "molecules.h"
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define all(s) s.begin(), s.end()
#define int long long

using namespace std;

vector <int> ans;

vector <pair <int, int> > w;

vector<int> find_subset(int l, int r, vector<int> asd) {
	
	int j = 0, sum = 0;
	
	for (int i = 0; i < (int)asd.size(); i++) {
		w.pb({asd[i], i});
	}
	sort(all(w));
	
	for (int i = 0; i < (int)w.size(); i++) { 
		sum += w[i].fr;
		while (j <= i && sum > r) {
			sum -= w[j].fr;
			j++;
		}
		if (sum >= l && sum <= r) {
			for (int k = j; k <= i; k++) {
				ans.pb(w[k].sc);
			}
			return ans;
		}
	}
	return ans;
}

Compilation message

/tmp/ccf7qTUM.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status