Submission #1221152

#TimeUsernameProblemLanguageResultExecution timeMemory
1221152SpyrosAlivRice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int besthub(int R, int L, int X[], ll B) { vector<int> coords; int n = R; ll b = B; for (int i = 0; i < n; i++) coords.push_back(X[i]); int maxAns = 0; int l = 0, r = 0; ll totDis = 0; for (int i = 0; i < n; i++) { if (i > 0) { int toL = i - l + 1; int toR = r - l + 1 - toL; totDis += toL * (coords[i] - coords[i-1]) - toR * (coords[i] - coords[i-1]); } r = max(r, i); while (r < n-1 && ((abs(coords[r+1] - coords[i]) <= abs(coords[i] - coords[l]) && l < i) || (abs(coords[r+1] - coords[i]) + totDis <= b))) { totDis += abs(coords[r+1] - coords[i]); r++; if (totDis > b) { totDis -= abs(coords[i] - coords[l]); l++; } } maxAns = max(maxAns, r - l + 1); } return maxAns; } int main() { int n, l, b; cin >> n >> l >> b; int x[n]; for (int i = 0; i < n; i++) cin >> x[i]; cout << besthub(n, l, x, b) << "\n"; }

Compilation message (stderr)

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