제출 #777053

#제출 시각아이디문제언어결과실행 시간메모리
777053Trisanu_Das기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#incldue <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:1:2: error: invalid preprocessing directive #incldue; did you mean #include?
    1 | #incldue <bits/stdc++.h>
      |  ^~~~~~~
      |  include
stations.cpp:4:1: error: 'vector' does not name a type
    4 | vector<int> adj[1000], U, V;
      | ^~~~~~
stations.cpp: In function 'void dfs(int, int)':
stations.cpp:9:15: error: 'adj' was not declared in this scope
    9 |   for(int v : adj[u]) if(v != p) dfs(v, u);
      |               ^~~
stations.cpp:10:21: error: 'label' was not declared in this scope
   10 |   if(!labelling[u]) label[u] = ++curr_tag;
      |                     ^~~~~
stations.cpp: At global scope:
stations.cpp:13:1: error: 'vector' does not name a type
   13 | vector<int> label(int n, int k, vector<int> u, vector<int> v){
      | ^~~~~~
stations.cpp:26:37: error: 'vector' has not been declared
   26 | int find_next_station(int s, int t, vector<int> c){
      |                                     ^~~~~~
stations.cpp:26:43: error: expected ',' or '...' before '<' token
   26 | int find_next_station(int s, int t, vector<int> c){
      |                                           ^
stations.cpp: In function 'int find_next_station(int, int, int)':
stations.cpp:27:6: error: 'c' was not declared in this scope
   27 |   if(c.back() < s) reverse(c.begin(), c.end());
      |      ^
stations.cpp:27:20: error: 'reverse' was not declared in this scope
   27 |   if(c.back() < s) reverse(c.begin(), c.end());
      |                    ^~~~~~~
stations.cpp:28:15: error: 'c' was not declared in this scope
   28 |   for(int x : c) if(min(s, x) <= t && t <= max(s, x)) return x;
      |               ^
stations.cpp:28:21: error: 'min' was not declared in this scope
   28 |   for(int x : c) if(min(s, x) <= t && t <= max(s, x)) return x;
      |                     ^~~
stations.cpp:28:44: error: 'max' was not declared in this scope
   28 |   for(int x : c) if(min(s, x) <= t && t <= max(s, x)) return x;
      |                                            ^~~
stations.cpp:29:10: error: 'c' was not declared in this scope
   29 |   return c.back();
      |          ^