Submission #112312

# Submission time Handle Problem Language Result Execution time Memory
112312 2019-05-18T17:28:15 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];
		while(sum>u) {
			sum-=w[a];
			      a++;
		}
		if(sum>=l&&sum<=u) {
			for(int i=a; i<=r; i++) {
				ans.push_back(w[i]);
			}
		}
		r++;
	}
	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 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 384 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer 18 violates the range [0, 12]
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 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 384 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 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 384 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 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 384 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 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 384 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -