#include <bits/stdc++.h>
#include "ricehub.h"
#define sz(s) (int)s.size()
using namespace std;
#define ll long long
int besthub(int n, int l, int a[], ll b){
multiset <ll> s;
ll ans = 0;
for(int i = 0; i < n; i++){
s.clear();
ll b1 = b, x = 0;
for(int j = 0; j < n; j++){
if(a[i] != a[j]){
s.insert(abs(a[i]-a[j]));
}
else x++;
}
while(b1 > 0 and sz(s) > 0){
ll k = *s.begin();
s.erase(s.begin());
if(b1 < k) break;
b1 -= k;
x++;
}
ans = max(ans,x);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
444 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
444 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
9 ms |
468 KB |
Output is correct |
22 |
Correct |
8 ms |
348 KB |
Output is correct |
23 |
Correct |
16 ms |
344 KB |
Output is correct |
24 |
Correct |
12 ms |
344 KB |
Output is correct |
25 |
Correct |
13 ms |
472 KB |
Output is correct |
26 |
Correct |
12 ms |
472 KB |
Output is correct |
27 |
Correct |
12 ms |
472 KB |
Output is correct |
28 |
Correct |
9 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
34 ms |
348 KB |
Output is correct |
4 |
Correct |
37 ms |
348 KB |
Output is correct |
5 |
Correct |
9 ms |
460 KB |
Output is correct |
6 |
Correct |
10 ms |
344 KB |
Output is correct |
7 |
Correct |
45 ms |
348 KB |
Output is correct |
8 |
Correct |
45 ms |
600 KB |
Output is correct |
9 |
Correct |
11 ms |
344 KB |
Output is correct |
10 |
Correct |
12 ms |
472 KB |
Output is correct |
11 |
Correct |
31 ms |
348 KB |
Output is correct |
12 |
Correct |
29 ms |
348 KB |
Output is correct |
13 |
Correct |
65 ms |
348 KB |
Output is correct |
14 |
Correct |
62 ms |
344 KB |
Output is correct |
15 |
Correct |
12 ms |
472 KB |
Output is correct |
16 |
Correct |
12 ms |
348 KB |
Output is correct |
17 |
Correct |
48 ms |
348 KB |
Output is correct |
18 |
Correct |
34 ms |
348 KB |
Output is correct |
19 |
Correct |
53 ms |
348 KB |
Output is correct |
20 |
Correct |
81 ms |
352 KB |
Output is correct |
21 |
Execution timed out |
1041 ms |
604 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1020 ms |
1368 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |