Submission #218946

# Submission time Handle Problem Language Result Execution time Memory
218946 2020-04-03T08:35:05 Z yayups Detecting Molecules (IOI16_molecules) C++11
0 / 100
5 ms 256 KB
// created 01 FEB 2018
// updated JUNE 2018
// updated JULY 2018
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <list>
#include <stdexcept>

#define N 200000

using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
	int n=w.size();
	vector<int> v(n);
	vector<int> result;
	v[0]=w[0];
	for(int i=0;i<n;i++) {
		v[i] = v[i-1]+w[i];
	}
	
	vector<int>::iterator low,up;
	
	int a,b=0;
	int t;
	
	//it's going to be v[b]-v[a]
	for(a=-1;a<n;a++) {
		if(a==-1) {
			t=0;
		}
		else {
			t=v[a];
		}
		low=lower_bound(v.begin()+(1+a),v.end(),l+t);
		up =upper_bound(v.begin()+(1+a),v.end(),u+t);
		//cout << "for a = " << a << " we have low = "<<low-v.begin()<<" and up= "<<up-v.begin() << endl;
		if(low-v.begin()<=up-v.begin()) {
			b=low-v.begin();
			break;
		}
	}
	//cout  << a<<endl<<b<<endl;
	result.clear();
	if(a==n) {
		return result;
	}
	
	for(int i=0;i<b-a;i++) {
		result.push_back(a+1+i);
	}
	
	//cout << a;
	
	return result;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB sum of weights should be in [302..304] but it is 351
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -