Submission #380953

#TimeUsernameProblemLanguageResultExecution timeMemory
380953IwanttobreakfreeFinding Routers (IOI20_routers)C++17
70.13 / 100
2 ms508 KiB
#include "routers.h" #include <vector> using namespace std; vector<int> find_routers(int lon, int n, int q) { vector<int> ans(n); ans[0]=0; int l=0,r,encontrados=1; for(int i=0;i<n-1;i++){ r=lon; int sol; while(l<=r){ int mid=(r-l)/2+l; int cerc=use_detector(mid); if(cerc<i+1){ l=mid+1; sol=mid; } else{ r=mid-1; } } ans[i+1]=2*sol-ans[i]; encontrados++; l=ans[i+1]; } return ans; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:23:12: warning: 'sol' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |  ans[i+1]=2*sol-ans[i];
      |           ~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...