제출 #1173036

#제출 시각아이디문제언어결과실행 시간메모리
1173036Robert_juniorSeptember (APIO24_september)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
vector<int>g[N];
int sz[N], pr[N];
void dfs(int v, int p){
    pr[v] = p;
    sz[v] = 1;
    for(auto to : g[v]){
        if(to == p) continue;
        dfs(to, v);
        sz[v] += sz[to];
    }
}
int main(){
    int N, M;
    cin>>N>>M;
    vector<int> F(N);
    vector<vector<int>> S(M, vector<int>(N));
    for(int i = 0; i < N; i++){
        cin>>F[i];
    }
    for(int i = 0; i < M; i++){
        for(int j = 0; j < N - 1; j++){
            cin>>S[i][j];
        }
    }
    vector<int>cnt(N);
    for(int i = 1; i < N; i++){
        g[F[i]].push_back(i);
        g[i].push_back(F[i]);
        sz[i] = cnt[i] = pr[i] = 0;
    }
    dfs(0, 0);
    int cur = 0;
    int ans = 0;
    int j = 0;
    while(j < N - 1){
        for(int i = 0; i < M; i++){
            cnt[S[i][j]]++;
            if(sz[S[i][j]] > 1){
                
            }
            if(cnt[S[i][j]] == M){
                cur++;
                sz[pr[S[i][j]]]--;
            }
        }
        if(cur == j + 1) ans++;
        j++;
    }
    cout<<ans;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccNJD41O.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cczi8hIC.o:september.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccNJD41O.o: in function `mtbpdhr2zxjo1o4i9oreohsbuzzl4s6u::taskcase()':
grader.cpp:(.text+0x50d): undefined reference to `solve(int, int, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status