제출 #1126037

#제출 시각아이디문제언어결과실행 시간메모리
1126037alecurse열대 식물원 (Tropical Garden) (IOI11_garden)C++20
컴파일 에러
0 ms0 KiB
#include <vector> #include <iostream> #include <queue> using namespace std; int N, M, P, Q; struct Arco { int to=-1; int lcycle=0; int ltocycle=0; int startcycle=0; }; vector<vector<bool> > vis; vector<vector<int> > pth; vector<vector<int> > adj; vector<vector<Arco> > sol; int current = 0; int untilreached = -1; Arco tosolve; void dfs(int x, int e, int th) { if(e!=-1) { if(vis[e][th]) { // do stuff; if(sol[e][th].to==-1) { sol[e][th].to=x; sol[e][th].lcycle=current+1-pth[e][th]; sol[e][th].ltocycle=0; sol[e][th].startcycle=e; untilreached=e; tosolve=sol[e][th]; return; } tosolve = sol[e][th]; return; } vis[e][th]=true; pth[e][th]=current; current++; } if(adj[x][1]==-1||adj[x][0]!=e) { dfs(adj[x][0],x,0); } else { dfs(adj[x][1],x,1); } if(e!=-1) { if(untilreached==-1) { sol[e][th]=tosolve; tosolve.to = x; tosolve.ltocycle++; } else { sol[e][th]=tosolve; tosolve.to = x; tosolve.startcycle=e; if(untilreached==e) { untilreached=-1; } } tosolve=sol[e][th]; } } int main() { cin>>N>>M>>P; adj.assign(N, vector<int> (2,-1)); vis.resize(N, vector<bool> (2)); pth.resize(N, vector<int> (2)); sol.resize(N, vector<Arco> (2)); for(int i=0;i<M;i++) { int a,b; cin>>a>>b; if(adj[a][0]==-1) { adj[a][0]=b; } else if(adj[a][1]==-1) { adj[a][1]=b; } if(adj[b][0]==-1) { adj[b][0]=a; } else if(adj[b][1]==-1) { adj[b][1]=a; } } for(int i=0;i<N;i++) { if(adj[i][0]!=-1) { if(sol[i][0].to!=-1) continue; Arco nuovo; tosolve=nuovo; untilreached=-1; dfs(i,-1,-1); } } }

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

/usr/bin/ld: /tmp/cca3hRHJ.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccAO3LyN.o:garden.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cca3hRHJ.o: in function `main':
grader.cpp:(.text.startup+0x3f): undefined reference to `count_routes(int, int, int, int (*) [2], int, int*)'
collect2: error: ld returned 1 exit status