Submission #1102133

#TimeUsernameProblemLanguageResultExecution timeMemory
1102133akzytrDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
	vector<int> result;

	int sum = 0;
	for(int i = 0; i < n; i++) {
		sum += a[i];
		if(sum >= l && sum <= u) {
            for(int j =0; j <= i; j++){
                result.push_back(j+1);
            }
            break;
		}
	}
	return result;
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:21: error: 'n' was not declared in this scope
   10 |  for(int i = 0; i < n; i++) {
      |                     ^
molecules.cpp:11:10: error: 'a' was not declared in this scope
   11 |   sum += a[i];
      |          ^