Submission #264303

# Submission time Handle Problem Language Result Execution time Memory
264303 2020-08-14T06:07:02 Z amalla Detecting Molecules (IOI16_molecules) C++17
Compilation error
0 ms 0 KB
#include "molecules.h"
#include<bits/stdc++.h>

using namespace std;

#define ll long long

vector<int> find_subset(int l, int u, vector<int> w) {
    int N = w.size(); sum = 0;
    for (int i = 0; i<N; ++i) {
        sum += w[i];
        if (l<=sum && sum<=u) {
            vector<int> Ans(i);
            for (int j = 0; j<=i; ++j) Ans[j] = j;
            return Ans;
        }
    }

    return vector<int>(0);
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:23: error: 'sum' was not declared in this scope
    9 |     int N = w.size(); sum = 0;
      |                       ^~~