Submission #299630

# Submission time Handle Problem Language Result Execution time Memory
299630 2020-09-15T11:10:06 Z Valee Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 256 KB
#include "molecules.h"
#include <bits/stdc++.h>

#define ll long long

using namespace std;

vector<int> find_subset(int l, int u, vector<int> v) {
	bool ok = false;
	vector<int>ans;
	int n = (int)v.size();
	sort(v.begin(), v.end());
	int lb = 0, rb = n+1, lans = 0, rans = 0;
	while (lb < rb && !ok){
		cout << lb << " " << rb << endl;
		ll m = (lb+rb)>>1, sum = 0;
		for (int i = 0; i < n; i++){
			if (i < m) sum += v[i];
			else sum += v[i]-v[i-m];
			if (l <= sum && sum <= u){
				lans = max(0LL, i-m+1); rans = i;
				ok = true;
				break;
			}
		}
		if (sum >= u) rb = m;
		else lb = m+1;
	}
	ll sum = 0;
	if (ok){
		for (int i = lans; i <= rans; i++){
			sum += v[i];
			ans.push_back(i);
		}
		if (sum < l || sum > u) ans.clear();
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Secret is incorrect!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Secret is incorrect!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Secret is incorrect!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Secret is incorrect!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Secret is incorrect!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Secret is incorrect!
2 Halted 0 ms 0 KB -