#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();
for(int j = 0; j < n; j++){
if(a[i] != a[j]){
s.insert(abs(a[i]-a[j]));
}
}
ll b1 = b, x = 0;
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+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
448 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
448 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
348 KB |
Output is correct |
9 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
33 ms |
344 KB |
Output is correct |
4 |
Correct |
44 ms |
348 KB |
Output is correct |
5 |
Incorrect |
9 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1028 ms |
1372 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |