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"
//# pragma GCC optimize("Ofast,no-stack-protector")
//# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
# pragma GCC optimize("Ofast")
# pragma GCC optimization ("unroll-loops")
# include "bits/stdc++.h"
/*
# include <ext/pb_ds/tree_policy.hpp>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/rope>
*/
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define rcg(s) cout << s;exit(0)
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define all(s) s.begin(),s.end()
# define sz(x) (int)((x).size())
# define int long double
using namespace std;
# undef int
int besthub(int n, int L, int a[], long long B)
{
# define int ll
int l = 1;
int r = n;
for(int i = 1;i < n;i++) a[i] += a[i - 1];
while(l < r)
{
int len = (l + r + 1) / 2;
bool ok = 0;
for(int i = len - 1;i < n;i++)
{
int lx = i - len + 1;
int rx = i;
int midx = (lx + rx) / 2;
int f = (a[midx] - (midx ? a[midx - 1] : 0)) * (midx - lx + 1) - a[midx] + (lx ? a[lx - 1] : 0);
f += a[rx] - (midx ? a[midx - 1] : 0) - (rx - midx + 1) * (a[midx] - (midx ? a[midx - 1] : 0));
ok |= (f <= B);
}
if(ok) l = len;
else r = len - 1;
}
return l;
}
Compilation message (stderr)
ricehub.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
# pragma GCC optimization ("unroll-loops")
# | 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... |