Submission #1078160

# Submission time Handle Problem Language Result Execution time Memory
1078160 2024-08-27T13:26:54 Z MohamedFaresNebili Beech Tree (IOI23_beechtree) C++17
Compilation error
0 ms 0 KB
#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

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) {
      |                                             ~~~~~~~~~~~~^