#include "ricehub.h"
#include "iostream"
#include "vector"
#include "map"
#include "math.h"
#include "string"
#include "algorithm"
#include "set"
#include <iterator>
#include <string.h>
#include <queue>
#include <list>
using namespace std;
typedef long long ll ;
const ll M = 998244353 ;
const ll oo = 1e13 ;
multiset<int> s ;
int besthub(int R, int L, int X[], long long B){
int ans = 0 ;
for(int i = 0 ; i < R ; ++i){
int md = (X[i] + X[R - 1]) / 2 , co = 0 ;
ll cost = 0 ;
s.clear();
for(int j = 0 ; j < R ; ++j){
s.insert(abs(md - X[j]));
}
for(auto x : s){
cost += x ;
if(cost > B){
break;
}
co++;
}
ans = max(ans , co);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
3 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
352 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
256 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
3 ms |
376 KB |
Output is correct |
21 |
Correct |
18 ms |
376 KB |
Output is correct |
22 |
Correct |
17 ms |
348 KB |
Output is correct |
23 |
Correct |
23 ms |
376 KB |
Output is correct |
24 |
Correct |
20 ms |
376 KB |
Output is correct |
25 |
Correct |
19 ms |
376 KB |
Output is correct |
26 |
Correct |
21 ms |
376 KB |
Output is correct |
27 |
Correct |
23 ms |
504 KB |
Output is correct |
28 |
Correct |
21 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
69 ms |
504 KB |
Output is correct |
4 |
Correct |
58 ms |
376 KB |
Output is correct |
5 |
Correct |
23 ms |
376 KB |
Output is correct |
6 |
Correct |
21 ms |
376 KB |
Output is correct |
7 |
Correct |
69 ms |
376 KB |
Output is correct |
8 |
Correct |
67 ms |
376 KB |
Output is correct |
9 |
Correct |
20 ms |
376 KB |
Output is correct |
10 |
Correct |
19 ms |
376 KB |
Output is correct |
11 |
Correct |
49 ms |
376 KB |
Output is correct |
12 |
Correct |
46 ms |
376 KB |
Output is correct |
13 |
Correct |
83 ms |
376 KB |
Output is correct |
14 |
Correct |
85 ms |
504 KB |
Output is correct |
15 |
Correct |
22 ms |
388 KB |
Output is correct |
16 |
Correct |
30 ms |
388 KB |
Output is correct |
17 |
Correct |
74 ms |
376 KB |
Output is correct |
18 |
Correct |
51 ms |
376 KB |
Output is correct |
19 |
Correct |
81 ms |
444 KB |
Output is correct |
20 |
Correct |
78 ms |
504 KB |
Output is correct |
21 |
Execution timed out |
1072 ms |
636 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1058 ms |
1400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |