Submission #424470

#TimeUsernameProblemLanguageResultExecution timeMemory
424470iraira655Finding Routers (IOI20_routers)C++17
0 / 100
2081 ms296 KiB
#include "routers.h" #include <iostream> #include <vector> using namespace std; vector<int> find_routers(int l, int n, int q) { vector<int> ans; ans.push_back(0); int prev = 0, check = 0, mid = 0, lo =0, hi = l, c =0; int asd = 0; for(int next=1; next<n; next++){ lo = ans[next-1], hi = l; while(lo<hi){ mid = lo + (hi-lo)/2; check = use_detector(mid); //cout<<hi<<" "<<lo<<" "<<mid<<" "<<check<<" "<<prev<<" cur: "<<asd<<"\n"; if(check == prev){ c = use_detector(mid+1); if(c == next){ ans.push_back(mid*2 - ans[next-1]); lo = mid+1; prev = next; break; } } else{ hi = mid; } } } return ans; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:13:5: warning: unused variable 'asd' [-Wunused-variable]
   13 | int asd = 0;
      |     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...