답안 #1078160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078160 2024-08-27T13:26:54 Z MohamedFaresNebili 참나무 (IOI23_beechtree) C++17
컴파일 오류
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) {
      |                                             ~~~~~~~~~~~~^