제출 #255295

#제출 시각아이디문제언어결과실행 시간메모리
255295Erkhemkhuu통행료 (IOI18_highway)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> //#include <highway.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define F first #define S second const int N = 100005; pair <ll, ll> par[N]; vector <int> w; vector <vector <pair <ll, ll> > > adj(N); ll flat[N], timer; bool vis[N]; void dfs(ll v) { vis[v] = true; flat[timer++] = v; for(auto &u: adj[v]) { if(vis[u.F]) continue; par[u.F] = {v, u.S}; dfs(u.F); } return; } void find_pair(int n, vector <int> u, vector <int> v, int a, int b) { ll i, m, max_cost, l, r, mid, s, t; m = u.size(); w.resize(m); for(i = 0; i < m; i++) { adj[u[i]].pb({v[i], i}); adj[v[i]].pb({u[i], i}); } dfs(0); for(i = 0; i < m; i++) w[i] = 1; max_cost = ask(w); for(i = 0; i < m; i++) w[i] = 0; l = 1; r = m; while(l < r) { mid = (l + r) / 2; for(i = l; i <= mid; i++) w[par[flat[i]].S] = 1; if(ask(w) >= max_cost) { r = mid; for(i = l; i <= mid; i++) w[par[flat[i]].S] = 1; } else l = mid + 1; } s = flat[l]; for(i = 0; i < m; i++) w[i] = 0; timer = 0; memset(vis, false, sizeof(vis)); memset(flat, 0, sizeof(flat)); memset(par, 0, sizeof(par)); dfs(s); l = 1; r = m; while(l < r) { mid = (l + r) / 2; for(i = l; i <= mid; i++) w[par[flat[i]].S] = 1; if(ask(w) >= max_cost) { r = mid; for(i = l; i <= mid; i++) w[par[flat[i]].S] = 0; } else l = mid + 1; } t = flat[l]; answer(s, t); return; }

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

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:36:16: error: 'ask' was not declared in this scope
     max_cost = ask(w);
                ^~~
highway.cpp:72:5: error: 'answer' was not declared in this scope
     answer(s, t);
     ^~~~~~
highway.cpp:72:5: note: suggested alternative: 'assert'
     answer(s, t);
     ^~~~~~
     assert