Submission #1078160

#TimeUsernameProblemLanguageResultExecution timeMemory
1078160MohamedFaresNebiliBeech Tree (IOI23_beechtree)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "beechtree.h" using namespace std; vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) { vector<int> ans(N, 0); vector<int> P(N, 0); for(int l = 2; l < N; l++) P[l] = P[l - 1] + (C[l] == C[l - 1]); for(int l = 0; l < N; l++) { if(P[N - 1] - P[l] == N - l - 1) ans[l] = 1; } return ans; }

Compilation message (stderr)

beechtree.cpp: In function 'std::vector<int> beechtree(int, int, std::vector<int>, std::vector<int>)':
beechtree.cpp:8:25: error: declaration of 'std::vector<int> P' shadows a parameter
    8 |             vector<int> P(N, 0);
      |                         ^
beechtree.cpp:6:57: note: 'std::vector<int> P' previously declared here
    6 |         vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) {
      |                                             ~~~~~~~~~~~~^