Submission #804967

# Submission time Handle Problem Language Result Execution time Memory
804967 2023-08-03T12:12:28 Z Gangsta Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
// a >> b = a / pow(2,b)
// a << b = a * pow(2,b)
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define sz size()
#define ss second
#define ff first
#define N 200001
#define pll pair<ll,ll>

using namespace std;

ll besthub(ll r, ll l, ll x[N], ll b){
	ll l1 = 1, r1 = l, md = 0, jog = -1, tmp, nd, ans, mx = 0;
	for(int i = 1; i <= l; i++){
		ans = 0;
		tmp = b;
		md = i;
		vector <ll> v;
		for(int i = 0; i < r; i++){
			v.pb(abs(md - x[i]));
		}
		sort(v.begin(), v.end());
		for(auto i : v){
			if(tmp <= i) break;
			ans++;
			tmp -= i;
		}
		mx = max(mx,ans);
	}
	return mx;
}

//int main(){
//	ll r, l, x[N], b;
//	cin >> r >> l;
//	for(int i = 0; i < r; i++) cin >> x[i];
//	cin >> b;
//	cout << besthub(r,l,x,b);
//}

Compilation message

ricehub.cpp: In function 'long long int besthub(long long int, long long int, long long int*, long long int)':
ricehub.cpp:15:5: warning: unused variable 'l1' [-Wunused-variable]
   15 |  ll l1 = 1, r1 = l, md = 0, jog = -1, tmp, nd, ans, mx = 0;
      |     ^~
ricehub.cpp:15:13: warning: unused variable 'r1' [-Wunused-variable]
   15 |  ll l1 = 1, r1 = l, md = 0, jog = -1, tmp, nd, ans, mx = 0;
      |             ^~
ricehub.cpp:15:29: warning: unused variable 'jog' [-Wunused-variable]
   15 |  ll l1 = 1, r1 = l, md = 0, jog = -1, tmp, nd, ans, mx = 0;
      |                             ^~~
ricehub.cpp:15:44: warning: unused variable 'nd' [-Wunused-variable]
   15 |  ll l1 = 1, r1 = l, md = 0, jog = -1, tmp, nd, ans, mx = 0;
      |                                            ^~
/usr/bin/ld: /tmp/ccbBNGKc.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