제출 #338634

#제출 시각아이디문제언어결과실행 시간메모리
338634blueRice Hub (IOI11_ricehub)C++11
컴파일 에러
0 ms0 KiB
#include <iostream> #include "ricehub.h" #include <vector> using namespace std; int besthub(int R, int L, int X[], long long B) //fields, max coordinate, i'th field, budget { vector<long long> F(R+2); F[0] = -(2e16 + 1); F[R+1] = (4e16 + 1); for(int i = 1; i <= R; i++) F[i] = X[i-1]; int l = 1; //leftmost field int m = 1; //hub int r = 1; //rightmost field long long c = 0; //current cost int res = 1; //running result while(1) { if(2*m < (l+r)) { c += (F[m+1] - F[m]) * ((m - (l - 1)) - (r - m)); m++; } if(F[r+1] - F[m] + c <= B) { c += F[r+1] - F[m]; r++; } else { c -= (F[m] - F[l]); l++; } res = max(res, r - l + 1); if(m == R) break; } return res; } int main() { int R, L; long long B; cin >> R >> L >> B; int X[R]; for(int i = 0; i < R; i++) cin >> X[i]; cout << besthub(R, L, X, B) << '\n'; }

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

/tmp/ccNq2CNv.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccoIZLwo.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status