Submission #1200593

#TimeUsernameProblemLanguageResultExecution timeMemory
1200593crispxxRice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#include "ricehub.h"

#include <bits/stdc++.h>
using namespace std;

#define all(x) x.begin(), x.end()
#define pb push_back
#define ar array
#define nl '\n'

#include "grader.cpp"

int besthub(int n, int l, int x[], long long B) {
	int ans = 0;
	for(int i = 0; i < n; i++) {
		int l = i - 1, r = i + 1, cost = 0, res = 1;
		while(l >= 0 && r < n) {
			int a = x[i] - x[l], b = x[r] - x[i];
			if(a < b) {
				if(cost + a > B) break;
				cost += a;
				l--;
			} else {
				if(cost + b > B) break;
				cost += b;
				r++;
			}
			res++;
		}
		while(l >= 0) {
			int a = x[i] - x[l];
			if(cost + a > B) break;
			cost += a;
			l--;
			res++;
		}
		while(r < n) {
			int a = x[r] - x[i];
			if(cost + a > B) break;
			cost += a;
			r++;
			res++;
		}
		ans = max(ans, res);
	}
	
	return ans;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccNqbvvF.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccgSjLQo.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status