제출 #1121417

#제출 시각아이디문제언어결과실행 시간메모리
1121417ezzzay9월 (APIO24_september)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back const int MN=1e6+5; vector<int>v[MN]; bool vis[MN]; int par[MN]; void dfs(int a){ vis[a]=1; for(auto b:v[a]){ if(vis[b]==1)continue; dfs(b); } } int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) { for(int i=0;i<N;i++){ v[i].clear(); vis[i]=0; } for(int i=1;i<N;i++){ par[i]=F[i]; v[F[i]].pb(i); } int k=0; for(auto a:S[0]){ if(vis[a]==0){ k++; dfs(a); } } return k; } void taskcase() { int N, M; cin>>N>>M; std::vector<int> F(N); F[0] = -1; for (int i = 1; i < N; ++i)cin>>F[i]; std::vector<std::vector<int>> S(M, std::vector<int>(N - 1)); for (int i = 0; i < M; ++i) for (int j = 0; j < N - 1; ++j)cin>>S[i][j]; cout<< solve(N, M, F, S); } int main() { int T=1; while(T--) taskcase(); return 0; }

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

/usr/bin/ld: /tmp/ccVj6RDM.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPkVUYO.o:september.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status