Submission #134060

# Submission time Handle Problem Language Result Execution time Memory
134060 2019-07-22T03:27:46 Z junodeveloper Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 KB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	int i;
	set<pair<long long,int> > st;
	long long sum=0;
	st.insert({0,-1});
	for(i=0;i<w.size();i++) {
		sum+=w[i];
		auto it=st.lower_bound({sum-u,0});
		if(it!=st.end()) {
			if(it->first<=sum-l) {
				vector<int> ans;
				for(int j=it->second+1;j<=i;j++) ans.push_back(j);
				return ans;
			}
		}
		st.insert({sum,i});
	}
	return vector<int>(0);
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<w.size();i++) {
          ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 12, answer = YES)
2 Correct 2 ms 376 KB OK (n = 12, answer = YES)
3 Correct 2 ms 376 KB OK (n = 12, answer = NO)
4 Correct 2 ms 376 KB OK (n = 12, answer = NO)
5 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -