Submission #883527

#TimeUsernameProblemLanguageResultExecution timeMemory
883527ibm2006Finding Routers (IOI20_routers)C++17
98.01 / 100
1 ms600 KiB
#include<bits/stdc++.h> #include "routers.h" using namespace std; typedef int ll; ll n,i,j,k,L,l,r,x,y,z,w,le[110000],ri[110000],b[110000]; vector<ll> a; ll f(ll x,ll y) { ll l=x,r=L,z; l=max(l,le[y]); r=min(r,ri[y]); ll mid=(l+r+1)/2; while(l<r) { mid=(l+r+1)/2; z=use_detector(mid); ri[z]=min(ri[z],mid-1); le[z-1]=min(le[z-1],mid); if(z==y-1) { l=mid; } else r=mid-1; } mid=(l+r+1)/2; b[y]=mid; return (mid-x)*2+x; } vector<int> find_routers(int l, int n, int q) { L=l; a.resize(n); for(i=0;i<n;i++) ri[i]=l; for(i=1;i<n;i++) { a[i]=f(a[i-1],i); } 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...