Submission #112315

# Submission time Handle Problem Language Result Execution time Memory
112315 2019-05-18T17:43:08 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;
	while(r<n&&a<n) {
		sum+=w[r];
		//cout<<sum<<endl;
		while(sum>u) {
			sum-=w[a];
			a++;
		}
		if(sum>=l&&sum<=u) {

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