Submission #313873

#TimeUsernameProblemLanguageResultExecution timeMemory
313873IWANTTOGETGOLDINIOIDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms256 KiB
#include "molecules.h"
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
	int n = w.size();
	std::vector <std::pair <int , int> > subset;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n; j++ ) {
			subset.push_back(std::make_pair (i , j));
		}
	}
	//std::sort (subset.begin(),subset.end());
	std::vector <int> ans;
	for (int i = 0; i < subset.size(); i++) {
		int sum = 0;
		for (int j = subset[i].first; j < subset[i].second; j++ ) {
			sum += w[j];
		}
		ans.clear();
		if (sum >= l && sum <= u) {
			for (int k = subset[i].first; k < subset[i].second; k++) {
				ans.push_back(k);
			}
			return ans;
		}
	}
	return ans;
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:17:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for (int i = 0; i < subset.size(); i++) {
      |                  ~~^~~~~~~~~~~~~~~
#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...