Submission #846787

#TimeUsernameProblemLanguageResultExecution timeMemory
846787ogkostyaBeech Tree (IOI23_beechtree)C++17
Compilation error
0 ms0 KiB
#include "beechtree.h" std::vector<int> beechtree(int N, int M, std::vector<int> P, std::vector<int> C) { std::vector<int> ans{ }; ans.push_back(1); bool sub2 = true; for (int i = N - 2; i >= 0; i--) { sub2 &= P[i] == i-1 && C[i] == C[N - 1]; ans.push_back(sub2 ? 1 : 0); } std::reverse(ans.begin(), ans.end()); return ans; }

Compilation message (stderr)

beechtree.cpp: In function 'std::vector<int> beechtree(int, int, std::vector<int>, std::vector<int>)':
beechtree.cpp:14:10: error: 'reverse' is not a member of 'std'
   14 |     std::reverse(ans.begin(), ans.end());
      |          ^~~~~~~