# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1084903 | PakinDioxide | Rice Hub (IOI11_ricehub) | C++17 | 1094 ms | 2956 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int l = 1, r = 0;
vector <pair <int, int>> p;
long long recal() {
long long sum = 0;
int ll = l, rr = r;
while (ll < rr) sum += p[rr--].first - p[ll++].first;
return sum;
}
int besthub(int n, int m, int a[], long long x) {
p.emplace_back(0, 0);
for (int j = 0; j < n; j++) {
int i = a[j];
if (p[p.size()-1].first != i) p.emplace_back(i, p[p.size()-1].second + 1);
else p[p.size()-1].second++;
}
// for (auto [x, y] : p) printf("%d %d\n", x, y);
// printf("S %d\n", p.size());
int mx = 0;
while (r < p.size() - 1) {
r++;
while (recal() > x) l++;
mx = max(mx, p[r].second - p[l-1].second);
// printf("MX %d\n", mx);
}
return mx;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |