# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
584650 |
2022-06-27T18:28:49 Z |
teki |
Rice Hub (IOI11_ricehub) |
C++11 |
|
15 ms |
2516 KB |
#include <bits/stdc++.h>
#include "ricehub.h"
typedef long long ll;
#define pb push_back
#define MS(x,y) memset((x),(y),sizeof((x)))
const ll MN = 1000000007;
using namespace std;
int besthub(int n, int l, int poz[], ll b) {
ll prefSuma[n];
MS(prefSuma,0);
for (ll i = 0; i<n; i++) {
prefSuma[i] = poz[i];
if (i != 0) prefSuma[i] += prefSuma[i-1];
}
ll from = 0;
ll res = 0;
for (ll to = 0; to<n; to++) {
ll mid = (from+to)/2;
ll levoS = mid-from;
ll desnoS = to-mid;
ll necBud = levoS*poz[mid];
necBud -= prefSuma[mid-1];
if (from != 0) necBud += prefSuma[from-1];
if (to > mid) {
necBud += prefSuma[to];
necBud -= prefSuma[mid];
necBud -= desnoS*poz[mid];
}
if (necBud > b) from++;
else res = max(res,to-from+1);
}
return res;
}
//int main()
//{
// #if LOCAL_DEBUG
// fstream cin("in.txt");
// #endif
//
// ios_base::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
//
// int niz[] = {1,2,10,12,14};
//
// cout<<besthub(5,20,niz,6)<<endl;
//
// return 0;
//}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
320 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
324 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
552 KB |
Output is correct |
3 |
Correct |
12 ms |
2516 KB |
Output is correct |
4 |
Correct |
12 ms |
2480 KB |
Output is correct |
5 |
Correct |
6 ms |
1236 KB |
Output is correct |
6 |
Correct |
5 ms |
1236 KB |
Output is correct |
7 |
Correct |
10 ms |
2260 KB |
Output is correct |
8 |
Correct |
11 ms |
2164 KB |
Output is correct |
9 |
Correct |
5 ms |
1108 KB |
Output is correct |
10 |
Correct |
6 ms |
1108 KB |
Output is correct |
11 |
Correct |
15 ms |
2500 KB |
Output is correct |
12 |
Correct |
12 ms |
2444 KB |
Output is correct |
13 |
Correct |
5 ms |
1200 KB |
Output is correct |
14 |
Correct |
6 ms |
1224 KB |
Output is correct |
15 |
Correct |
9 ms |
1964 KB |
Output is correct |
16 |
Correct |
9 ms |
1964 KB |
Output is correct |
17 |
Correct |
11 ms |
2260 KB |
Output is correct |
18 |
Correct |
11 ms |
2216 KB |
Output is correct |
19 |
Correct |
12 ms |
2388 KB |
Output is correct |
20 |
Correct |
11 ms |
2396 KB |
Output is correct |