답안 #460401

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
460401 2021-08-09T06:23:41 Z Khizri 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back		 
#define F first																 
#define S second 															 
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
int besthub(int n, int l, int arr[], long long k)
{
	ll ans=0;
	for(int i=0;i<r;i++){
		int ii=arr[i];
		vector<int>vt;
		for(int j=0;j<n;j++){
			vt.pb(abs(arr[j]-ii));
		}
		sort(all(vt));
		ll x=k,q=0;
		for(int j=0;j<n;j++){
			if(x>=vt[j]){
				x-=vt[j];
				q=j+1;
			}
			else{
				break;
			}
		}
		ans=max(ans,q);
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:19:16: error: 'r' was not declared in this scope
   19 |  for(int i=0;i<r;i++){
      |                ^