제출 #777055

#제출 시각아이디문제언어결과실행 시간메모리
777055Trisanu_Das기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> adj[1000], U, V; int N, K, curr_tag, labelling[1000]; void dfs(int u, int p){ if(p == -1 || !labelling[p]) labelling[u] = ++curr_tag; for(int v : adj[u]) if(v != p) dfs(v, u); if(!labelling[u]) label[u] = ++curr_tag; } vector<int> label(int n, int k, vector<int> u, vector<int> v){ N = n; K = k; U = u, V = v; for(int i = 0; i < n; i++) adj[i].clear(); memset(labelling, 0, sizeof(labelling)); for(int i = 0; i < n - 1; i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0, -1); return labelling; } int find_next_station(int s, int t, vector<int> c){ if(c.back() < s) reverse(c.begin(), c.end()); for(int x : c) if(min(s, x) <= t && t <= max(s, x)) return x; return c.back(); }

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

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:10:21: error: 'label' was not declared in this scope
   10 |   if(!labelling[u]) label[u] = ++curr_tag;
      |                     ^~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:23:10: error: could not convert 'labelling' from 'int [1000]' to 'std::vector<int>'
   23 |   return labelling;
      |          ^~~~~~~~~
      |          |
      |          int [1000]