Submission #672011

# Submission time Handle Problem Language Result Execution time Memory
672011 2022-12-14T15:40:50 Z Hacv16 Rice Hub (IOI11_ricehub) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "ricehub.h"

using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;

int besthub(ll n, ll l, ll x[], ll b){
	ll ans = 0;

	for(int mid = 0; mid < n; mid++){
		ll cnt = 1, l = mid - 1, r = mid + 1, av = b;
  	
  		while(b && (l >= 0 || r < n)){
  			int dl = (l >= 0 ? x[mid] - x[l] : INF);
  			int dr = (r <  n ? x[r] - x[mid] : INF);

  			if(av - min(dl, dr) < 0) break;
  			av -= min(dl, dr);

  			if(dl < dr) l--;
  			else r++;

  			cnt++;
  		}
  		
  		ans = max(ans, cnt);
	}

	return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccKRidNm.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status