제출 #1233688

#제출 시각아이디문제언어결과실행 시간메모리
1233688lioowFinding Routers (IOI20_routers)C++20
컴파일 에러
0 ms0 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; std::vector<int> find_routers(int le, int n, int q) { int ans[n],lol[n]; ans[0]=0; vector<int>memo(le+2,-1); for(int i=1;i<=n-1;i++){ int l=0; int r=le; int an=-1; int lol=-1; while(l<=r){ int mid=(l+r)/2; int nw; if(memo[mid]==-1){ nw=use_detector(mid); memo[mid]=nw; } else nw=memo[mid]; if(nw>i-1) r=mid-1; else { an=mid; l=mid+1; } } ans[i]=an*2-ans[i-1]; } return ans; }

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

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:29:16: error: could not convert 'ans' from 'int [n]' to 'std::vector<int>'
   29 |         return ans;
      |                ^~~
      |                |
      |                int [n]