제출 #641291

#제출 시각아이디문제언어결과실행 시간메모리
641291knon0501Finding Routers (IOI20_routers)C++14
77.94 / 100
2 ms724 KiB
#include "routers.h" #include <bits/stdc++.h>; using namespace std; int memo[100005]; std::vector<int> find_routers(int l, int n, int q) { vector<int> ans={0}; // cout<<l<<" "<<n<<" "<<q<<endl; for(int i=1 ; i<n ; i++){ int lef=ans[i-1]+1; int rig=l; int k; while ((rig>=lef)) { int mid=lef+rig>>1; int x; if(memo[mid]){ x=memo[mid]; } else x=use_detector(mid); memo[mid]=x; if(x<=i-1){ k=mid; lef=mid+1; } else{ rig=mid-1; } } ans.push_back(2*k-ans[i-1]); // cout<<i<<" "<<ans[i]<<"!\n"; } return ans; }

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

routers.cpp:2:25: warning: extra tokens at end of #include directive
    2 | #include <bits/stdc++.h>;
      |                         ^
routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:17:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |             int mid=lef+rig>>1;
      |                     ~~~^~~~
routers.cpp:35:24: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |         ans.push_back(2*k-ans[i-1]);
      |                       ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...