답안 #743026

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
743026 2023-05-17T07:29:14 Z vjudge1 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include "ricehub.h"

#include<bits/stdc++.h>

using namespace std ;

using ll = long long ; 
using pii = pair<ll , ll> ; 

const int N = 1e6+5 ; 

ll qs[N] , ans = 0; 

deque<pii> dq ; 

ll besthub(int R, int L, int X[], long long B)
{
  for(int i=0;i<R;i++){
      qs[X[i]]++ ; 
  }
  for(int i=1;i<=L;i++){
    qs[i] += qs[i-1] ; 
  }
  
  dq.push_back({0 , -1});
    for(int i=0;i<=L;i++){
        while(!dq.empty() && dq.front().second < i - B){
            dq.pop_front();
        }
        ans = max(ans , qs[i] - dq.front().first) ;

        while(!dq.empty() && dq.back().first >= qs[i]){
            dq.pop_back();
        }
        dq.push_back({qs[i] , i});
    }

    return ans ; 
}

Compilation message

ricehub.cpp:16:4: error: ambiguating new declaration of 'll besthub(int, int, int*, long long int)'
   16 | ll besthub(int R, int L, int X[], long long B)
      |    ^~~~~~~
In file included from ricehub.cpp:1:
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);
      |     ^~~~~~~