Submission #614327

#TimeUsernameProblemLanguageResultExecution timeMemory
614327shezittDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

// Subtask 1

vector<int> find_subset(int l, int u, vector<int> w) {
	int x = w[0], n = w.size();
	if(x == l && x == u){
		return {0};
	}
	int i;
	for(i=0, aux=0; i<n && aux < l; ++i){
		aux += x;
	}
	if(aux >= l && aux <= u){
		vector<int> ans(i);
		iota(ans.begin(), ans.end(), 0);
		return ans;
	}
	return {};
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:14:11: error: 'aux' was not declared in this scope
   14 |  for(i=0, aux=0; i<n && aux < l; ++i){
      |           ^~~
molecules.cpp:17:5: error: 'aux' was not declared in this scope
   17 |  if(aux >= l && aux <= u){
      |     ^~~