Submission #739035

#TimeUsernameProblemLanguageResultExecution timeMemory
739035ThylOneDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms212 KiB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	
	vector<int> prefixSum;
	prefixSum.push_back(0);
	for(int i=0;i<w.size();i++){
		prefixSum.push_back(prefixSum[i]+w[i]);
	}
	vector<int> R;
	for(int I=0;I<w.size();I++){
		
		
		if(w[I]>=l && w[I]<=u)return {I};
		int score = 0;
		for(int j=I;j<w.size();j++){
			score += w[j];
			if(score>=l && score<=u)return {min(I,j),max(I,j)};
		}
		
	}
	return {};
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for(int i=0;i<w.size();i++){
      |              ~^~~~~~~~~
molecules.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int I=0;I<w.size();I++){
      |              ~^~~~~~~~~
molecules.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int j=I;j<w.size();j++){
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...