Submission #1200603

#TimeUsernameProblemLanguageResultExecution timeMemory
1200603crispxxRice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define pb push_back #define ar array #define nl '\n' #include "grader.cpp" int besthub(int n, int l, int x[], long long B) { vector<int> pref(n + 1); vector<int> a(n + 1); for(int i = 0; i < n; i++) { a[i + 1] = x[i]; pref[i + 1] = pref[i] + x[i]; } auto sum = [&](int l, int r) { if(l > r) return 0; return pref[r] - pref[l - 1]; }; int ans = 0; for(int i = 1; i <= n; i++) { int l = i, r = n; while(l < r) { int mid = (l + r + 1) >> 1; int j = (i + mid) >> 1; int cost = a[j] * (j - i) - sum(i, j - 1) + sum(j + 1, mid) - a[j] * (mid - j); if(cost <= B) { l = mid; } else { r = mid - 1; } } ans = max(ans, r - i + 1); } return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cciLhJyu.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccAyxh5u.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status