Submission #848265

# Submission time Handle Problem Language Result Execution time Memory
848265 2023-09-11T22:54:31 Z Plurm Beech Tree (IOI23_beechtree) C++17
Compilation error
0 ms 0 KB
#include "beechtree.h"

std::vector<int> beechtree(int N, int M, std::vector<int> P,
                           std::vector<int> C) {
  std::vector<int> ret;
  bool ok = true;
  ret.push_back(1);
  ret.push_back(1);
  for (int i = N - 3; i >= 0; i--) {
    if (C[i + 1] != C[i + 2])
      ok = false;
    if (ok)
      ret.push_back(1);
    else
      ret.push_back(0);
  }
  reverse(ret.begin(), ret.end());
  return ret;
}

Compilation message

beechtree.cpp: In function 'std::vector<int> beechtree(int, int, std::vector<int>, std::vector<int>)':
beechtree.cpp:17:3: error: 'reverse' was not declared in this scope
   17 |   reverse(ret.begin(), ret.end());
      |   ^~~~~~~