Submission #574919

#TimeUsernameProblemLanguageResultExecution timeMemory
574919KrisjanisPFinding Routers (IOI20_routers)C++14
70.48 / 100
2 ms340 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_routers(int l, int n, int q) { //cout<<"l: "<<l<<"\n"; vector<int> res(n,0); for(ll i=1;i<n;i++) { ll a = 1, b = l; while(a<=b) { ll m = (a+b)/2; ll x = use_detector(m); if(x<i) a=m+1; else if(x==i) { res[i] = m; b = m-1; } else b=m-1; } res[i] = res[i-1]+2*(res[i]-res[i-1]-1); } //cout<<"res: "; for(ll x: res) cout<<x<<" "; cout<<"\n"; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...