제출 #1255431

#제출 시각아이디문제언어결과실행 시간메모리
1255431robijoyFinding Routers (IOI20_routers)C++17
컴파일 에러
0 ms0 KiB
/* * Starting with the name of almighty ALLAH */ #include "routers.h" using namespace std; const int N = 1e5+5; int dp[N]; vector<int> find_routers(int size, int n, int q) { memset(dp,-1,sizeof(dp)); vector<int> ans; ans.push_back(0); int last = 0; for (int i = 0; i < n-1; ++i) { int l = ans[ans.size()-1]+1, r = size; int an = 0; while(l<=r) { int mid = (l+r)>>1; int x = 0; if(dp[mid]!=-1) { x = dp[mid]; }else { x = use_detector(mid); dp[mid] = x; } if(x == last) { l = mid+1; }else{ an = mid; r = mid-1; } } int lasti = ans[ans.size()-1]; int dis = an - lasti; dis--; ans.push_back(lasti+(dis*2)); last++; } return ans; }

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

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:13:5: error: 'memset' was not declared in this scope
   13 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
routers.cpp:6:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    5 | #include "routers.h"
  +++ |+#include <cstring>
    6 | using namespace std;