답안 #661212

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
661212 2022-11-25T00:01:41 Z benjaminkleyn 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
    #include <bits/stdc++.h>
    #include "ricehub.h"
    using namespace std;
    typedef long long ll;
     
    ll pref[100001], x[100000];
     
    ll sum(int l, int r)
    {
        return pref[r+1] - pref[l];
    }
     
    ll cost(int l, int r, int i)
    {
        return sum(i + 1, r) + x[i] * (2 * i - l - r) - sum(l, i - 1);
    }
     
    ll find_min(int l, int r)
    {
        int lo = l, hi = r;
        while (hi - lo >= 5)
        {
            int m1 = lo + 8 * (hi - lo) / 5;
            int m2 = hi - 8 * (hi - lo) / 5;
            if (cost(l, r, m1) < cost(l, r, m2))
                hi = m2 - 1;
            else
                lo = m1;
        }
        for (int i = lo + 1; i <= hi; i++)
            if (cost(l, r, i) < cost(l, r, lo))
                lo = i;
        return cost(l, r, lo);
    }
     
    ll calc(int R, int X[], int cnt)
    {
        ll mn = LLONG_MAX;
        for (int l = 0, r = cnt - 1; r < R; l++, r++)
            mn = min(mn, find_min(l, r));
        return mn;
    }
     
    int besthub(int R, int L, int X[], ll B) 
    {
        for (int i = 0; i < R; i++)
            x[i] = X[i], pref[i + 1] = pref[i] + X[i];
     
        int lo = 0, hi = R;
        while (lo < hi)
        {
            int mid = (lo + hi + 1) / 2;
     
            if (calc(R, X, mid) <= B)
                lo = mid;
            else hi = mid - 1;
        }
        return lo;
    }

Compilation message

ricehub.cpp:5:5: error: extended character   is not valid in an identifier
    5 |      
      |     ^
ricehub.cpp:7:5: error: extended character   is not valid in an identifier
    7 |      
      |     ^
ricehub.cpp:12:5: error: extended character   is not valid in an identifier
   12 |      
      |     ^
ricehub.cpp:17:5: error: extended character   is not valid in an identifier
   17 |      
      |     ^
ricehub.cpp:35:5: error: extended character   is not valid in an identifier
   35 |      
      |     ^
ricehub.cpp:43:5: error: extended character   is not valid in an identifier
   43 |      
      |     ^
ricehub.cpp:48:5: error: extended character   is not valid in an identifier
   48 |      
      |     ^
ricehub.cpp:53:5: error: extended character   is not valid in an identifier
   53 |      
      |     ^
ricehub.cpp:5:5: error: '\U000000a0' does not name a type
    5 |      
      |     ^
ricehub.cpp:7:5: error: '\U000000a0' does not name a type
    7 |      
      |     ^
ricehub.cpp:12:5: error: '\U000000a0' does not name a type
   12 |      
      |     ^
ricehub.cpp:17:5: error: '\U000000a0' does not name a type
   17 |      
      |     ^
ricehub.cpp:35:5: error: '\U000000a0' does not name a type
   35 |      
      |     ^
ricehub.cpp:43:5: error: '\U000000a0' does not name a type
   43 |      
      |     ^