Submission #319347

# Submission time Handle Problem Language Result Execution time Memory
319347 2020-11-05T01:38:54 Z barsbold Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 372 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> find_subset(int L, int u, std::vector<int> w) {
	sort(w.begin(), w.end());
	int n = w.size();
	int l =0;
	int r = 0;
	long long sum = w[0];
	vector<int > ans;
	while(r <n){
		while(sum >u && l<=r){
			sum-=w[l];
			l++;
		}
		if(sum >= L){
			for(int i = l; i<=r; i++){
				ans.push_back(w[i]);
			}
			break;
		}
		r++;
	}
	if(!ans.size()){
		ans.push_back(0);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 372 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB sum of weights should be in [302..304] but it is 50
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 372 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 372 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 372 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 372 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -