Submission #1116793

#TimeUsernameProblemLanguageResultExecution timeMemory
1116793vladiliusFinding Routers (IOI20_routers)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second vector<int> all; int N; int use_detector(int x){ pii out = {1e9, 0}; for (int i = 0; i < N; i++){ out = min(out, {abs(x - all[i]), i}); } return out.ss; } vector<int> find_routers(int k, int n, int q){ auto f = [&](int x){ return use_detector(x); }; vector<pii> rr(n); function<void(int, int, int, int)> solve = [&](int l, int r, int l1, int r1){ if (l > r) return; int m = (l + r) / 2; int lb = l1, rb = r1; while (lb + 1 < rb){ int mb = (lb + rb) / 2, t = f(mb); if (t < m){ lb = mb + 1; } else { rb = mb - (t != m); } } while (f(lb) != m) lb++; int L = lb; rb = r1; while (lb + 1 < rb){ int mb = (lb + rb) / 2, t = f(mb); if (t > m){ rb = mb - 1; } else { lb = mb; } } while (f(rb) != m) rb--; int R = rb; rr[m] = {L, R}; solve(l, m - 1, l1, L - 1); solve(m + 1, r, R + 1, r1); }; solve(0, n - 1, 0, k); vector<int> out = {0}; for (int i = 0; i < n - 1; i++){ out.pb(2 * rr[i].ss - out.back()); }; return out; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc9K1uYp.o: in function `use_detector(int)':
grader.cpp:(.text+0x0): multiple definition of `use_detector(int)'; /tmp/ccLFdOmp.o:routers.cpp:(.text+0xa0): first defined here
collect2: error: ld returned 1 exit status