Submission #172237

# Submission time Handle Problem Language Result Execution time Memory
172237 2019-12-31T18:42:41 Z yum Detecting Molecules (IOI16_molecules) C++17
0 / 100
2 ms 376 KB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<long long, long long> pl;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const double EPS = 1e-6;

vector<int> find_subset(int l, int u, vector<int> w) {
	int n = (int)w.size();
	vector<int> arr(n);
	iota(arr.begin(), arr.end(), 0);
	sort(arr.begin(), arr.end(), [&](int i, int j) {return w[i] < w[j];});
	ll p1 = 0, sum = 0; 
	for (int i = 0; i < n; ++i) {
		while (p1 < n && sum < l) sum += w[arr[p1++]];
		if (l <= sum && sum <= u) {
			vector<int> ans;
			for (int j = i; j < p1; ++j) ans.push_back(arr[i]);
			sort(ans.begin(), ans.end());
			return ans;
		}
	}
	return vector<int>();
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB item #0 is taken twice
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
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 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB item #0 is taken twice
5 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 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB item #0 is taken twice
5 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 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB item #0 is taken twice
5 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 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 376 KB item #0 is taken twice
5 Halted 0 ms 0 KB -