Submission #460401

#TimeUsernameProblemLanguageResultExecution timeMemory
460401Khizri쌀 창고 (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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++){
      |                ^