Submission #241166

# Submission time Handle Problem Language Result Execution time Memory
241166 2020-06-23T07:37:20 Z crossing0ver Detecting Molecules (IOI16_molecules) C++17
0 / 100
5 ms 384 KB
#include<bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> answer(vector<int> &ans,deque<int> v) {
	for (int i = 0; i < v.size(); i++) {
		ans.push_back(v[i]);
	}
	return ans;
}
vector<int> find_subset(int l, int u, vector<int> w) {
	int n = w.size();
	sort(w.begin(),w.end());
	long long tot = 0;
	deque<int> v;
	vector<int> ans;
	if (w[0] > u) return ans;
	for (int i = 0; i < n; i++) {
		if ( tot + w[i] < l) {
			tot+=w[i];
			v.push_back(i); 
		}	
	}
	int in = v.back();
	for (int i = in + 1; i < n; i++) {
		if (w[i] + tot >= l && w[i] + tot <= u) {
			v.push_back(i);
			return answer(ans,v);
		}
		if (w[i] + tot > u) {
			tot -= w[v.front()];
			v.pop_front();
		}
		tot += w[i];
			v.push_back(i);
		if (tot >= l && tot <= u) return answer(ans,v);
	}
	return ans;
}


        

Compilation message

molecules.cpp: In function 'std::vector<int> answer(std::vector<int>&, std::deque<int>)':
molecules.cpp:5:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < v.size(); i++) {
                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB OK (n = 12, answer = YES)
2 Correct 5 ms 384 KB OK (n = 12, answer = YES)
3 Correct 5 ms 256 KB OK (n = 12, answer = NO)
4 Correct 5 ms 256 KB OK (n = 12, answer = NO)
5 Correct 5 ms 256 KB OK (n = 12, answer = YES)
6 Correct 5 ms 256 KB OK (n = 12, answer = YES)
7 Correct 5 ms 384 KB OK (n = 12, answer = YES)
8 Correct 5 ms 384 KB OK (n = 12, answer = YES)
9 Correct 5 ms 256 KB OK (n = 6, answer = YES)
10 Correct 5 ms 256 KB OK (n = 12, answer = YES)
11 Correct 4 ms 256 KB OK (n = 100, answer = NO)
12 Incorrect 5 ms 384 KB sum of weights should be in [50..51] but it is 73
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -