Submission #878895

# Submission time Handle Problem Language Result Execution time Memory
878895 2023-11-25T12:43:58 Z Gray Bomb (IZhO17_bomb) C++17
Compilation error
0 ms 0 KB
vector<ll> find_subset(int s, int e, std::vector<int> w) {
	ll n = w.size();
	vector<pair<ll, ll>> bw(n);
	for (ll i=0; i<n; i++){
		bw[i] = {w[i], i};
	}
	sort(bw.rbegin(), bw.rend());
	ll l=0,r=0,sum=bw[0].ff;
	while (r<n) {
		if (sum<s){
			r++;
			if (r==n) break;
			sum+=bw[r].ff;
		}else{
			if (sum<e){
				vector<ll> ind;
				for (ll i=l; i<=r; i++){
					ind.push_back(bw[i].ss);
				}
				return ind;
			}
			sum-=bw[l].ff;
			l++;
		}
	}
	return vector<ll>(0);
}

Compilation message

bomb.cpp:1:1: error: 'vector' does not name a type
    1 | vector<ll> find_subset(int s, int e, std::vector<int> w) {
      | ^~~~~~