Submission #264861

#TimeUsernameProblemLanguageResultExecution timeMemory
264861BasilhijazHighway Tolls (IOI18_highway)C++11
Compilation error
0 ms0 KiB
//#include "highway.h" #include <bits/stdc++.h> using namespace std; void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) { int M = U.size(); vector<int> w(M); for(int i = 0; i < M; i++){ w[i] = 0; } vector<vector<pair<int, int> > > adj(N); for(int i = 0; i < M; i++){ adj[U[i]].push_back({V[i], i}); adj[V[i]].push_back({U[i], i}); } long long curr = ask(w); int where = 0; bool ok = 1; while(ok){ ok = 0; int lo = 0; int hi = adj[where].size() - 1; while(lo < hi){ for(int j = lo; j < (lo + hi + 1)/2; j++){ w[adj[where][j].second] = !w[adj[where][j].second]; } long long last = ask(w); if(last != curr){ curr = last; ok = 1; hi = (lo + hi + 1)/2 - 1; } else{ lo = (lo + hi + 1)/2; } } if(ok)where = lo; } answer(0, where); }

Compilation message (stderr)

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:17:20: error: 'ask' was not declared in this scope
   17 |   long long curr = ask(w);
      |                    ^~~
highway.cpp:39:3: error: 'answer' was not declared in this scope
   39 |   answer(0, where);
      |   ^~~~~~