Submission #112317

# Submission time Handle Problem Language Result Execution time Memory
112317 2019-05-18T18:04:04 Z ioilolcom Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 384 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;
	for(int i=0; i<n; i++) {
		if(sum+w[i]<=l) {sum+=w[i]; r=i;}
		else{
			break;
		}
	}
	while(r<n) {
		if(sum>=l&&sum<=u) {
			break;
		}
		sum+=w[++r];
		sum-=w[a++];
	}

	for(int i=a; i<=r; i++) {
		ans.push_back(i);
	}
	if(ans.size()) return ans;
	return std::vector<int>(0);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 12, answer = YES)
2 Correct 2 ms 384 KB OK (n = 12, answer = YES)
3 Incorrect 2 ms 256 KB Integer 12 violates the range [0, 11]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -