Submission #878899

# Submission time Handle Problem Language Result Execution time Memory
878899 2023-11-25T12:52:27 Z Gray Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 348 KB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include <cassert>
#include <vector>
#define ll long long
#define ln "\n"
#define ff first
#define ss second
#define ld long double
const ll INF = 2e18;
const ll MOD = 1e9+7;
using namespace std;

vector<ll> find_subset(int s, int e, std::vector<int> w) {
	ll n = w.size();
	vector<pair<ll, ll>> bw(n);
	for (ll i=0; i<n; i++){
		bw[i] = {w[i], i};
	}
	sort(bw.begin(), bw.end());
	ll l=0,r=0,sum=bw[0].ff;
	while (r<n) {
		if (sum<s){
			r++;
			if (r==n) break;
			sum+=bw[r].ff;
		}else{
			if (sum<=e){
				vector<ll> ind;
				for (ll i=l; i<=r; i++){
					ind.push_back(bw[i].ss);
				}
				return ind;
			}
			sum-=bw[l].ff;
			l++;
		}
	}
	return vector<ll>(0);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB item #0 is taken twice
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -