답안 #378059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
378059 2021-03-15T22:11:37 Z MilosMilutinovic 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
#include "race.h"
#include <bits/stdc++.h>

using namespace std;

int besthub(int n, int len, int* a, long long b) {
  vector<long long> pref(n);
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      pref[i] = a[i];
    } else {
      pref[i] = pref[i - 1] + a[i];
    }
  }
  auto Can = [&](int l, int r) {
    int mid = l + r >> 1;
    long long ll = (long long) a[mid] * (mid - l + 1) - (pref[mid] - (l == 0 ? 0LL: pref[l - 1]));
    long long rr = pref[r] - pref[mid] - (long long) a[mid] * (r - mid);
    return ll + rr <= b;
  };
  int ans = 1;
  for (int i = 0; i < n; i++) {
    int bot = i, top = n - 1, mx = 0;
    while (bot <= top) {
      int mid = bot + top >> 1;
      if (Can(i, mid)) {
        mx = mid - i + 1;
        bot = mid + 1;
      } else {
        top = mid - 1;
      }
    }
    ans = max(ans, mx);
  }
  return ans;
}

Compilation message

ricehub.cpp:1:10: fatal error: race.h: No such file or directory
    1 | #include "race.h"
      |          ^~~~~~~~
compilation terminated.