Submission #314406

# Submission time Handle Problem Language Result Execution time Memory
314406 2020-10-19T19:52:02 Z LucaDantas Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 384 KB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
#define pb push_back

vector<int> find_subset(int l, int u, vector<int> w) {
	int n = (int)(w.size());
	vector<int> ind(n);
	for(int i = 0; i < n; i++)
		ind[i] = i;
	sort(all(ind), [&](int a, int b){
		return w[a] < w[b];
	});
	sort(all(w));
	int pref = 0, suf = 0, i = 0;
	vector<int> ans;
	for(; i < n && pref <= u; i++) {
		if(suf >= l) {
			deque<int> extra;
			for(int pos = n-i; pos < n; pos++)
				extra.pb(pos);
			while(suf > u) {
				suf -= w[extra.back()];
				extra.pop_back();
				extra.push_front(n-1-i);
				suf += w[n-1-i];
				i++;
			}
			for(auto it : extra)
				ans.pb(ind[it]);
			break;
		}
		pref += w[i];
		suf += w[n-1-i];
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 12, answer = YES)
2 Correct 0 ms 256 KB OK (n = 12, answer = YES)
3 Correct 0 ms 256 KB OK (n = 12, answer = NO)
4 Correct 1 ms 256 KB OK (n = 12, answer = NO)
5 Correct 1 ms 384 KB OK (n = 12, answer = YES)
6 Correct 0 ms 256 KB OK (n = 12, answer = YES)
7 Correct 1 ms 256 KB OK (n = 12, answer = YES)
8 Correct 0 ms 256 KB OK (n = 12, answer = YES)
9 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -