제출 #1035629

#제출 시각아이디문제언어결과실행 시간메모리
1035629Mr_Husanboy기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define all(a) (a).begin(), (a).end() #define ff first #define ss second template<typename T> int len(T &a){return a.size();} mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<vector<int>> g(n); for(int i = 0; i < n - 1;i ++){ g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } vector<int> tout(n); int tim = 0; auto dfs = [&](auto &dfs, int i, int p = -1)->void{ for(auto u : g[i]){ if(u == p) continue; dfs(dfs, u, i); } tout[i] = tim ++; }; dfs(dfs, 0); assert(len(g[0]) == 1); tout[0] = 1000; return tout; } int find_next_station(int s, int t, vector<int> c) { if(len(c) == 1) return c[0]; assert(tout[0] != 1000); if(s < t){ return c.back(); } if(c.back() > s) c.pop_back(); for(auto u : c) cout << u << endl; for(int i = 1; i < len(c); i ++){ if(c[i - 1] < t && t <= c[i]){ return c[i]; } } return c[0]; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from stations.cpp:2:
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:42:9: error: 'tout' was not declared in this scope; did you mean 'stdout'?
   42 |  assert(tout[0] != 1000);
      |         ^~~~