Submission #883534

#TimeUsernameProblemLanguageResultExecution timeMemory
883534ibm2006Finding Routers (IOI20_routers)C++17
Compilation error
0 ms0 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; srand(time(NULL)); for(i=1;i<n;i++) { p[i]=i; } random_shuffle(p+1,p+n); for(i=1;i<n;i++) { a[p[i]]=f(a[p[i]-1],p[i]); } return a; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:38:13: error: 'p' was not declared in this scope
   38 |             p[i]=i;
      |             ^
routers.cpp:40:24: error: 'p' was not declared in this scope
   40 |         random_shuffle(p+1,p+n);
      |                        ^