//#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <functional>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
#define mp make_pair
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
const lld pi = 3.14159265358979323846;
#define MAXI (int)2e5+5
int besthub(int r,int l,int x[],ll b){
int ans = 0;
ll pref[r+1];
pref[0] = 0;
for(int i = 1;i<=r;i++){
pref[i] = pref[i-1] + x[i-1];
}
for(int i = 0;i<r;i++){
for(int j = i;j<r;j++){
int mid = (i+j) >> 1;
ll cost = (ll)(mid-i)*x[mid]-pref[mid]-pref[i]; // Seg unten
cost += (ll)pref[j+1]-pref[mid+1]-(j-mid)*x[mid]; // seg oben
if(cost <= b) ans = max(j-i+1,ans);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
537 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |