Submission #557494

#TimeUsernameProblemLanguageResultExecution timeMemory
557494MounirA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "books.h"

using namespace std;

void solve(int nLivres, int aPrendre, long long borneInf, int S) {
    vector<long long> vals(nLivres);
    long long sum = 0;
    for (int i = 0; i < aPrendre; ++i)
        vals[i] = skim(i + 1), sum += vals[i];
    if (sum > 2 * borneInf)
        impossible();
    vector<int> ans = {};
    if (sum >= borneInf){
        for (int i = 1; i <= aPrendre; ++i)
            ans.pb(i);
        answer(ans);
        return;
    }

    for (int i = aPrendre; i < nLivres; ++i){
        vals[i] = skim(i + 1);
        sum += vals[i] - vals[i - aPrendre];
        if (sum >= borneInf){
            if (sum > 2 * borneInf){
                for (int j = 1; j < aPrendre; ++j)
                    ans.pb(j);
                ans.pb(i);
                answer(ans);
            }
            else {
                for (int j = 0; j < aPrendre; ++j)
                    ans.pb(i - j);
                answer(ans);
            }
        }
    }
    impossible();
}

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:16:17: error: 'class std::vector<int>' has no member named 'pb'
   16 |             ans.pb(i);
      |                 ^~
books.cpp:27:25: error: 'class std::vector<int>' has no member named 'pb'
   27 |                     ans.pb(j);
      |                         ^~
books.cpp:28:21: error: 'class std::vector<int>' has no member named 'pb'
   28 |                 ans.pb(i);
      |                     ^~
books.cpp:33:25: error: 'class std::vector<int>' has no member named 'pb'
   33 |                     ans.pb(i - j);
      |                         ^~