#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int besthub(int n, int m, int a[], ll k)
{
ll ans = 0;
for(int i = 0; i < n; i++){
multiset<int> S; S.clear();
for(int j = 0; j < n; j++)
S.insert(abs(a[i]-a[j]));
ll K = k, cnt = 0;
while(!S.empty() and K>=(*S.begin()))
cnt++, K-=(*S.begin()), S.erase(S.begin());
if(ans<cnt)ans=cnt;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
300 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 |
2 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
2 ms |
204 KB |
Output is correct |
16 |
Correct |
2 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
2 ms |
204 KB |
Output is correct |
20 |
Correct |
2 ms |
204 KB |
Output is correct |
21 |
Correct |
23 ms |
320 KB |
Output is correct |
22 |
Correct |
21 ms |
204 KB |
Output is correct |
23 |
Correct |
24 ms |
324 KB |
Output is correct |
24 |
Correct |
24 ms |
204 KB |
Output is correct |
25 |
Correct |
24 ms |
324 KB |
Output is correct |
26 |
Correct |
24 ms |
204 KB |
Output is correct |
27 |
Correct |
24 ms |
332 KB |
Output is correct |
28 |
Correct |
22 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
204 KB |
Output is correct |
2 |
Correct |
3 ms |
204 KB |
Output is correct |
3 |
Correct |
78 ms |
332 KB |
Output is correct |
4 |
Correct |
76 ms |
332 KB |
Output is correct |
5 |
Correct |
22 ms |
324 KB |
Output is correct |
6 |
Correct |
26 ms |
204 KB |
Output is correct |
7 |
Correct |
92 ms |
352 KB |
Output is correct |
8 |
Correct |
104 ms |
336 KB |
Output is correct |
9 |
Correct |
22 ms |
332 KB |
Output is correct |
10 |
Correct |
22 ms |
324 KB |
Output is correct |
11 |
Correct |
57 ms |
332 KB |
Output is correct |
12 |
Correct |
56 ms |
308 KB |
Output is correct |
13 |
Correct |
104 ms |
336 KB |
Output is correct |
14 |
Correct |
103 ms |
332 KB |
Output is correct |
15 |
Correct |
26 ms |
204 KB |
Output is correct |
16 |
Correct |
23 ms |
324 KB |
Output is correct |
17 |
Correct |
66 ms |
332 KB |
Output is correct |
18 |
Correct |
64 ms |
332 KB |
Output is correct |
19 |
Correct |
105 ms |
332 KB |
Output is correct |
20 |
Correct |
104 ms |
340 KB |
Output is correct |
21 |
Execution timed out |
1090 ms |
460 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1099 ms |
1356 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |