제출 #582819

#제출 시각아이디문제언어결과실행 시간메모리
582819LucaIlie기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> #define MAX_N 1000 using namespace std; int l; vector<int> edges[MAX_N]; vector<int> labels; void dfs( int u, int p, int d ) { if ( d == 0 ) labels[u] = l * 2; l++; for ( int v: edges[u] ) { if ( v != p ) dfs( v, u, 1 - d ); } if ( d == 1 ) labels[u] = l * 2 + 1; if ( edges[u].size() > 1 ) l++; } vector<int> label( int n, int k, vector<int> u, vector<int> v ) { for ( int i = 0; i < n - 1; i++ ) { edges[u[i]].push_back( v[i] ); edges[v[i]].push_back( u[i] ); } labels.resize( n ); l = 0; dfs( 0, -1, 0 ); return labels; } int find_next_station( int s, int t, vector<int> c ) { int l, r, d, i; return c[0]; } int main() { vector <int> lab = label(5, 10, {0, 1, 1, 2}, {1, 2, 3, 4}); cout << "labels "; for ( auto x: lab ) cout << x << " "; cout << "\n"; cout << find_next_station(4, 10, {9, 13}) << "\n"; }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:41:9: warning: unused variable 'l' [-Wunused-variable]
   41 |     int l, r, d, i;
      |         ^
stations.cpp:41:12: warning: unused variable 'r' [-Wunused-variable]
   41 |     int l, r, d, i;
      |            ^
stations.cpp:41:15: warning: unused variable 'd' [-Wunused-variable]
   41 |     int l, r, d, i;
      |               ^
stations.cpp:41:18: warning: unused variable 'i' [-Wunused-variable]
   41 |     int l, r, d, i;
      |                  ^
/usr/bin/ld: /tmp/ccpKtEl8.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc5GEF43.o:stations.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status