답안 #1109867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109867 2024-11-08T01:42:21 Z santi3223 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define ff(i, p, x) for (ll i = p; i < x; i++)
#define ed "\n"

ll besthub(ll r, ll l, vl x, ll b){
	vl psum(r+1, 0);
	ff(i, 1, r){
		psum[i] = psum[i-1]+x[i];
	}
	ll ri = 0, c = 0;
	ff(le, 0, r){
		while(ri < r){
			ll mid = le + (ri-le)/2;
			if(le % 2 == ri % 2){
				mid++;
			}
			ll q = 0;
			if((le+ri+1) % 2 != 0){
				q -= x[mid];
			}
			q -= psum[mid]-psum[le];
			q += psum[ri+1] - psum[mid];
			if(q > b){
				break;
			}
			ri++;
		}
		if(c < ri-le){
			c = ri-le;
		}
		if(ri == r){
			break;
		}
	}
	return c;
}

Compilation message

/usr/bin/ld: /tmp/cc9bfeZR.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