Submission #1105884

# Submission time Handle Problem Language Result Execution time Memory
1105884 2024-10-28T08:35:09 Z abushbandit_ Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 336 KB
#include "molecules.h"
#include "bits/stdc++.h"

using namespace std;

vector<int> find_subset(int a, int b, vector<int> w) {
	vector<pair<int,int>> w2;
	int j = 1;
	for(auto i : w) w2.push_back({i,j++});
	sort(w.begin(),w.end());
	sort(w2.begin(),w2.end());
	int n = w.size();
	int resr = 0,resl = n;
	int l = 0;
	int ans = 0;
	int sum = 0;
	for(int r = 0;r < n;r++) {
		sum += w[r];
		if(sum < a) {
			continue;
		}
		while(sum > b && l <= r) {
			sum -= w[l];
			l++;
		}
		if(sum >= a && sum < b) {
			if(ans < r - l + 1) {
				ans = r - l + 1;
				resr = r,resl = l;
			}
		}
	}
	vector<int> res;
	for(int i = resl;i <= resr;i++) {
		res.push_back(w2[i].second);
	}
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 12, answer = YES)
2 Correct 1 ms 336 KB OK (n = 12, answer = YES)
3 Correct 1 ms 336 KB OK (n = 12, answer = NO)
4 Correct 1 ms 336 KB OK (n = 12, answer = NO)
5 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -