Submission #574950

#TimeUsernameProblemLanguageResultExecution timeMemory
574950Valters07Finding Routers (IOI20_routers)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "routers.h" #pragma GCC optimize("O2,unroll-loops") #define fio ios_base::sync_with_stdio(0);cin.tie(0); #define ll long long #define en cin.close();return 0; #define pb push_back #define fi first//printf("%lli\n",cur); #define se second//scanf("%lli",&n); #define r0 return 0; using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> find_routers(int len, int n, int q) { vector<int> ans(n); int idx = 0, lst = 0, sq = sqrt(n); for(int i = 1;i<n;i++) { int l = lst, r = len; if(l+sq<r) { int t = use_detector(l+sq); if(t==idx) l=mid; else r=mid-1; } while(l<r) { int mid = (l+r+1)/2, ind = use_detector(mid); if(ind==idx) l=mid; else r=mid-1; } int nwpos = lst + (l-lst)*2, nwind = use_detector(nwpos); ans[nwind]=nwpos; lst=nwpos; idx=nwind; } return ans; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:24:19: error: 'mid' was not declared in this scope
   24 |                 l=mid;
      |                   ^~~
routers.cpp:26:19: error: 'mid' was not declared in this scope
   26 |                 r=mid-1;
      |                   ^~~