Submission #581639

#TimeUsernameProblemLanguageResultExecution timeMemory
581639zaneyuFinding Routers (IOI20_routers)C++14
100 / 100
71 ms684 KiB
#include "routers.h" #include<bits/stdc++.h> using namespace std; #define f first #define s second map<int,int> mp; std::vector<int> find_routers(int L, int N, int q) { vector<int> A(N); for(int i=1;i<N;i++){ int l=A[i-1],r=L; for(auto x:mp){ if(x.s==i-1) l=x.f; } for(auto x:mp){ if(x.s>=i){ r=x.f; break; } } while(l<r){ int mid=(l+r+1)/2; if(!mp.count(mid)) mp[mid]=use_detector(mid); if(mp[mid]==i-1) l=mid; else r=mid-1; } A[i]=A[i-1]+(l-A[i-1])*2; } return A; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...