Submission #1254157

#TimeUsernameProblemLanguageResultExecution timeMemory
1254157asimRice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define endl "\n" #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); // 10 ^ 8 bool check(long long m, long long n, long long b, const vector<long long> &arr) { if (m > n) { return false; } for (int i = 1; i <= n - m + 1; i++) { long long a = 0; for (int j = i; j < i + m; j++) { a += (abs(arr[j] - arr[i + m / 2])); } if (a <= b) { return true; } } return false; } void solve() { long long n, r, b; cin >> n >> r >> b; vector<long long> arr(n + 10); for (int i = 1; i <= n; i++) { cin >> arr[i]; } long long l1 = 1; long long best = 1; while (l1 <= r) { long long m = (r + l1) / 2; if (check(m, n, b, arr)) { l1 = m + 1; best = m; } else { r = m - 1; } } cout << best << endl; } int main() { IOS solve(); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccDjjT2x.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccU6XMv7.o:ricehub.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccDjjT2x.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