Submission #867538

#TimeUsernameProblemLanguageResultExecution timeMemory
867538StefanL2005Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;

vector<int> find_subset(int L, int R, vector<int> v)
{
    int n = v.size();
    vector<pair<int,int>> w(n);
    for (int i = 0; i < n; i++)
        w[i] = make_pair(v[i], i);

    deque<int> Q;
    vector<int> result;
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += w[i].first;
        Q.push_back(w[i].second);

        while(sum > R && !Q.empty())
        {
            sum -= w[Q.front()];
            Q.pop_front();
        }
    }

    while(!Q.empty())
    {
        result.push_back(Q.front());
        Q.pop_front();       
    }

    return ans;
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:14:5: error: 'll' was not declared in this scope
   14 |     ll sum = 0;
      |     ^~
molecules.cpp:17:9: error: 'sum' was not declared in this scope
   17 |         sum += w[i].first;
      |         ^~~
molecules.cpp:33:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |     return ans;
      |            ^~~
      |            abs