답안 #289392

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289392 2020-09-02T15:51:14 Z BeanZ 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "ricehub.h"

using namespace std;

#define ll long long
#define endl '\n'
const int N = 1e5 + 5;
ll besthub(int r, int l, int x[], ll b){
        ll lf = 1, rt = 1;
        ll cur = 0, ans = 0;
        while (rt < r && (cur + (x[rt] - x[0])) <= b) rt++;
        ans = max(ans, rt - lf + 1);
        for (int i = 2; i <= r; i++){
                cur = cur - (rt - i + 1) * (x[i - 1] - x[i - 2]);
                cur = cur + (i - lf) * (x[i - 1] - x[i - 2]);
                while (cur > b){
                        cur = cur - (x[i - 1] - x[l - 1]);
                        lf++;
                }
                while (rt < r && (cur + x[rt] - x[i - 1]) <= b){
                        cur = cur + x[rt] - x[i - 1];
                        rt++;
                }
                ans = max(ans, rt - lf + 1);
        }
        return ans;
}
/*
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("time.in", "r")){
                freopen("time.in", "r", stdin);
                freopen("time.out", "w", stdout);
        }
}
/*
*/

Compilation message

ricehub.cpp:38:1: warning: "/*" within comment [-Wcomment]
   38 | /*
      |  
ricehub.cpp:9:4: error: ambiguating new declaration of 'long long int besthub(int, int, int*, long long int)'
    9 | ll besthub(int r, int l, int x[], ll b){
      |    ^~~~~~~
In file included from ricehub.cpp:2:
ricehub.h:1:5: note: old declaration 'int besthub(int, int, int*, long long int)'
    1 | int besthub(int R, int L, int X[], long long B);
      |     ^~~~~~~