제출 #136573

#제출 시각아이디문제언어결과실행 시간메모리
136573Lawliet전선 연결 (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define MAX 5010 using namespace std; int N, M; int curComponent; int node[MAX]; bool isCycle[MAX]; bool isSpecial[MAX]; bool ArezouOwn[MAX]; bool BorzouOwn[MAX]; vector<int> grafo[MAX]; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { N = a.size(); M = u.size(); for(int g = 0 ; g < M ; g++) { if(u[g] == v[g]) isCycle[ u[g] + 1 ] = true; else grafo[ u[g] + 1 ].push_back( v[g] + 1 ); } for(int g = 0 ; g < r.size() ; g++) isSpecial[ r[g] + 1 ] = true; for(int g = 0 ; g < N ; g++) { if(a[g] == 1) ArezouOwn[g + 1] = true; else BorzouOwn[g + 1] = true; } vector<int> ans; for(int curStation = 1 ; curStation <= N ; curStation++) { int aux = curStation; bool flag = false; while( true ) { if(isCycle[aux] && isSpecial[aux] && ArezouOwn[aux]) { ans.push_back(1); flag = true; break; } if(isCycle[aux] && !isSpecial[aux] && BorzouOwn[aux]) { ans.push_back(0); flag = true; break; } if(grafo[aux].empty()) break; aux = grafo[aux].back(); } if(!flag) ans.push_back( 0 ); } return ans; } /*int main() { int nn, mm, n1, n2; scanf("%d %d",&nn,&mm); vector<int> v1, v2; vector<int> uu, vv; for(int g = 0 ; g < nn ; g++) v1.push_back( 1 ); v2.push_back(0); //v2.push_back(3); v2.push_back(5); for(int g = 0 ; g < mm ; g++) { scanf("%d %d",&n1,&n2); n1--;n2--; uu.push_back( n1 ); vv.push_back( n2 ); } vector<int> ans = who_wins(v1 , v2 , uu , vv); for(int g = 0 ; g < nn ; g++) printf("%d ",ans[g]); }*/

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

wiring.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
wiring.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int g = 0 ; g < r.size() ; g++)
                  ~~^~~~~~~~~~
/tmp/ccDferGV.o: In function `main':
grader.cpp:(.text.startup+0x23b): undefined reference to `min_total_length(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status