제출 #684162

#제출 시각아이디문제언어결과실행 시간메모리
684162sudheerays123쌀 창고 (IOI11_ricehub)C++17
컴파일 에러
0 ms0 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define ll int const ll N = 100+5 , INF = 1e18 , MOD = 1e9+7; ll besthub(ll R, ll L, ll X[], ll B){ ll low = 1 , high = R; ll ans; function<bool(ll)> check = [&](ll l){ for(ll i = 1; i <= R-l+1; i++){ ll j = i+l-1; ll mid = (i+j)/2; ll cost = 0; for(ll k = i; k <= j; k++) cost += abs(X[k]-X[mid]); if(cost <= B) return true; } return false; }; while(low <= high){ ll mid = (low+high)/2; if(check(mid)){ ans = mid; low = mid+1; } else high = mid-1; } return ans; }

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

ricehub.cpp:6:28: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    6 | const ll N = 100+5 , INF = 1e18 , MOD = 1e9+7;
      |                            ^~~~
ricehub.cpp: In function 'int besthub(int, int, int*, int)':
ricehub.cpp:37:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |  return ans;
      |         ^~~
/usr/bin/ld: /tmp/ccR5eIvn.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status