Submission #1346914

#TimeUsernameProblemLanguageResultExecution timeMemory
1346914michael12Rice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<string>
#include<stack>
#include<queue>
#include<string.h>
#include<array>
#include<climits>
#include<algorithm>
#include<cmath>
using namespace std;
#define ff first
#define ss second
#define int long long
#define endl '\n'
const int maxn = 5e5;
int besthub(int R, int L, vector<int> x, int B){
    vector<int> pref(R);
    int mx = 0;
    for(int i = 0; i < R; i++){
      int cur = 0;
      int cnt = 0;
      int low = i;
      int high = i;
      while(cur <= B){
         if(low > 0 && high < R - 1){
            if(abs(x[low] - x[i]) > abs(x[high] - x[i])){
              high += 1;
              cnt += 1;
              cur += abs(x[high] - x[i]);
            }
            else{
              low -= 1;
              cnt += 1;
              cur += abs(x[low] - x[i]);
            }
         }
         else if(low > 0){
            low -= 1;
            cnt += 1;
            cur += abs(x[low] - x[i]);
         }
         else{
          high += 1;
          cnt += 1;
          cur += abs(x[high] - x[i]);
         }
      }
      mx = max(cnt, mx);
      // X[i]
    }
    return mx;
}
// signed main(){
//   int R, L;
//   vector<int> X(R);
//   int B;
//   cin >> R >> L >> B;
//   for(int i = 0; i < R; i++){
//     cin >> X[i];
//   }
//   int a = besthub(R, L, X, B);
//   cout << a;

// }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccHHnVZe.o: in function `main':
grader.cpp:(.text.startup+0xaa): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status