Submission #306576

#TimeUsernameProblemLanguageResultExecution timeMemory
306576peti1234Finding Routers (IOI20_routers)C++17
100 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "routers.h" using namespace std; vector<int> sz; int el=0, id=0, c=64, kis, nagy, po; vector<int> find_routers(int h, int n, int q) { sz.push_back(0); for (int i=1; i<n; i++) { if (n==2) kis=el+1, nagy=h; else { kis=el+1, nagy=min(h, el+c), po=c; while(use_detector(nagy)==id) { kis=nagy, nagy=min(h, nagy+po), po*=2; } } while(nagy-kis>1) { int koz=(nagy+kis)/2; if (use_detector(koz)==id) kis=koz; else nagy=koz; } sz.push_back(2*kis-el), el=sz.back(), id++; } return sz; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...