Submission #112313

# Submission time Handle Problem Language Result Execution time Memory
112313 2019-05-18T17:39:28 Z ioilolcom Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	sort(w.begin(),w.end());
	vector<int> ans;
	int a=0;
	int r=0;
	int n=(int)w.size();
	ll sum=0;
	while(r<n&&a<n) {
		sum+=w[r];
		while(sum>u) {
			sum-=w[a]
			      a++;
		}
		if(sum>=l&&sum<=u) {
			for(int i=a; i<=r; i++) {
				ans.push_back(w[i]);
			}
			goto ok;
		}
		r++;
	}
ok:     ;
	if(ans.size()) return ans;
	return std::vector<int>(0);
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:17:10: error: expected ';' before 'a'
          a++;
          ^