Submission #306574

#TimeUsernameProblemLanguageResultExecution timeMemory
306574peti1234Finding Routers (IOI20_routers)C++17
72.85 / 100
2 ms416 KiB
#include <bits/stdc++.h> #include "routers.h" using namespace std; vector<int> sz; int el=0, id=0, c=128; /* int use_detector(int a) { cout.flush() << a << "\n"; int x; cin >> x; return x; } */ vector<int> find_routers(int h, int n, int q) { sz.push_back(0); for (int i=1; i<n; i++) { /* int kis=el+1, nagy=min(h, el+c); while(use_detector(nagy)==id) { kis=nagy, nagy=min(h, nagy+c); } */ int kis=el+1, nagy=h; 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...