Submission #130283

# Submission time Handle Problem Language Result Execution time Memory
130283 2019-07-14T16:52:09 Z UserIsUndefined Rice Hub (IOI11_ricehub) C++11
Compilation error
0 ms 0 KB
#include "grader.h"
#include <bits/stdc++.h>
#include <iostream>     
#include <algorithm>
#include <vector>
 
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))


int X[100005];
int D[100005];
bool visited[100005];

int gethalf(int n){
    int hal = (n)/2;
    D[0] = hal;
    int ind = 1;

    for (int i = 1 ; i < n/2+2 ; i++){
    if (hal+i < n){
        D[ind] = hal+i;
        ind++;
    }
    if (hal-i >= 0){
        D[ind] = hal-i;
        ind++;
    }
    }


}

int besthub(int n, int L, int X[], long long B){
    int maxx = 0;

    gethalf(n);



    for (int h = 0 ; h < n ; h++){
        long long bud = B;
        int g = D[h];
        int i = g;
        int j = g+1;
        int cont = 0;

        while ((i >= 0)||(j < n)){
            long long absi = abs(X[g] - X[i]);
            long long absj = abs(X[g] - X[j]);
            if (i < 0)absi = LONG_MAX;
            if (j >= n)absj = LONG_MAX;

            if (bud-min(absi,absj) < 0)break;

            if (absi < absj){
                i--;
                bud-= absi;
                cont++;
            }
            else {
                j++;
                bud-= absj;
                cont++;
            }

        }
        maxx = max(maxx,cont);
        if (maxx == n)break;


    }
    return maxx;

}

Compilation message

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