Submission #117627

#TimeUsernameProblemLanguageResultExecution timeMemory
117627Osama_AlkhodairyHighway Tolls (IOI18_highway)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "highway.h" #include "grader.cpp" using namespace std; #define ll long long int n; vector <pair <int, int> > es, g[90001]; ll light; int find(int root){ vector <bool> vis(n); queue <int> ready; vector <int> depth(n); ready.push(root); vector <int> edges; while(ready.size()){ int node = ready.front(); vis[node] = 1; ready.pop(); for(auto &i : g[node]){ if(vis[i.first]) continue; depth[i.first] = depth[node] + 1; edges.push_back(i.second); ready.push(i.first); } } reverse(edges.begin(), edges.end()); int l = 0, r = n - 1; while(l <= r){ int mid = (l + r) / 2; vector <int> check(n - 1); for(int i = 0 ; i <= mid ; i++){ check[edges[i]] = 1; } if(ask(check) != light) r = mid - 1; else l = mid + 1; } auto edge = es[edges[l]]; if(depth[edge.first] > depth[edge.second]) return edge.first; return edge.second; } void find_pair(int N, std::vector<int> u, std::vector<int> v, int a, int b) { n = N; for(int i = 0 ; i < n - 1 ; i++){ g[u[i]].push_back(make_pair(v[i], i)); g[v[i]].push_back(make_pair(u[i], i)); es.push_back(make_pair(u[i], v[i])); } light = ask(vector <int>(n - 1, 0)); int s = find(0); int t = find(s); answer(s, t); }

Compilation message (stderr)

/tmp/cch2niQF.o: In function `ask(std::vector<int, std::allocator<int> > const&)':
grader.cpp:(.text+0x70): multiple definition of `ask(std::vector<int, std::allocator<int> > const&)'
/tmp/ccAFntbE.o:highway.cpp:(.text+0xa0): first defined here
/tmp/cch2niQF.o: In function `answer(int, int)':
grader.cpp:(.text+0x1e0): multiple definition of `answer(int, int)'
/tmp/ccAFntbE.o:highway.cpp:(.text+0x210): first defined here
/tmp/cch2niQF.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccAFntbE.o:highway.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status