Submission #319351

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

std::vector<int> find_subset(int L, int u, std::vector<int> w) {
	int n = w.size();
	vector<pair<int , int >> vi;
	for(int i = 0 ; i< n; i++){
		vi.pb(mp(w[i],i));	
	}

	sort(vi.begin(), vi.end());
	
	int l =0;
	int r = 0;
	long long sum = vi[0].first;
	vector<int > ans;
	while(r <n){
		while(sum >u && l<=r){
			sum-=vi[l].first;
			l++;
		}
		if(sum >= L){
			for(int i = l; i<=r; i++){
				ans.push_back(vi[i].second);
			}
			break;
		}
		r++;
		sum+=vi[r].first;
	}
	if(!ans.size()){
		ans.push_back(0);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 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 Correct 1 ms 364 KB OK (n = 12, answer = YES)
2 Correct 0 ms 364 KB OK (n = 12, answer = YES)
3 Incorrect 1 ms 384 KB sum of weights should be in [307..317] but it is 50
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 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 364 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 364 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 364 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -