Submission #239129

# Submission time Handle Problem Language Result Execution time Memory
239129 2020-06-14T14:24:06 Z T0p_ Detecting Molecules (IOI16_molecules) C++14
0 / 100
5 ms 384 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) 
{
	vector<int> ans;
	int n = w.size();
	long long sum = 0;
	deque<int> deq;
	sort(w.begin(), w.end());
	for(int i=0 ; i<n ; i++)
	{
		deq.push_back(w[i]);
		sum += w[i];
		while(sum > u)
		{
			sum -= deq.front();
			deq.pop_front();
		}
		if(l <= sum && sum <= u)
		{
			while(!deq.empty())
			{
				ans.push_back(deq.front());
				deq.pop_front();
			}
			return ans;
		}
	}
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 5 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 5 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 5 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 5 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 5 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 5 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 5 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 5 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 5 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 5 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -