#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define vt vector
#define pb push_back
#define all(x) x.begin(),x.end()
typedef vt<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
ll prefsum[100005];
int besthub(int r, int l, int x[], ll b){
prefsum[0] = 0;
for(int i = 1; i <= r; i++){
prefsum[i] = prefsum[i-1]+x[i-1];
}
int ans = 1;
for(int i = 0; i < r; i++){
for(int j = ans+1; j < r; j++){
int mid = (i+j)>>1;
ll n = (ll)x[mid]*(2*mid-j-i+1)-(prefsum[mid+1]-prefsum[i])+(prefsum[j+1]-prefsum[mid+1]);
if(n < b){
ans = max(ans,j-i+1);
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1004 ms |
520 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |