제출 #380966

#제출 시각아이디문제언어결과실행 시간메모리
380966IwanttobreakfreeFinding Routers (IOI20_routers)C++17
59.73 / 100
2 ms1132 KiB
#include "routers.h" #include <vector> using namespace std; vector<int> guarda(100001,-1); vector<int> find_routers(int lon, int n, int q) { vector<int> ans(n); vector<int> maxinum(n,0); vector<int> mininum(n,lon); ans[0]=0; int l,r; for(int i=0;i<n;i++){ l=maxinum[i]; r=mininum[i+1]; int sol; while(l<=r){ int mid=(r-l)/2+l,cerc; if(guarda[mid]==-1)cerc=guarda[mid]=use_detector(mid); else cerc=guarda[mid]; if(cerc<i+1){ l=mid+1; sol=mid; } else{ r=mid-1; } if(maxinum[cerc]<mid)maxinum[cerc]=mid; if(mininum[cerc]>mid)mininum[cerc]=mid; } ans[i+1]=2*sol-ans[i]; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:29:12: warning: 'sol' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |  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...