Submission #943760

# Submission time Handle Problem Language Result Execution time Memory
943760 2024-03-11T20:16:17 Z attky Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h> 

using namespace std;

struct Info {
	int PosAvant = -1, TpsArrivee = -1;
	bool vu = false;
	void entree(int p, int t, bool v) {
	    PosAvant = p;
	    TpsArrivee = t;
	    vu = v;
	}
};

vector<int> find_subset(int l, int u, vector<int> w) {
	int n = w.size(), pos = 0;
	bool possible = false;
	sort(w.begin(), w.end());
	Info Tab[u+1];
	Tab[0].entree(-1, -1, true);
	for(int loop = 0; loop < n; ++loop) {
		for(int looping = u; looping >= 0; --looping) {
			if(Tab[looping].vu) {
				int suivant = looping + w[loop];
				if(suivant <= u) {
					if(!Tab[suivant].vu) {
						Tab[suivant].entree(looping, loop, true);
						if(suivant >= l) {
							possible = true;
							pos = suivant;
							break;
						}
					}
				}
			}
		}
		if(possible) {
			break;
		}
	}
	vector<int> subset;
	while(pos > 0) {
		subset.push_back(w[Tab[pos].TpsArrivee]);
		pos = Tab[pos].PosAvant;
	}
	return subset;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Integer 51 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -