#include <bits/stdc++.h>
#include "ricehub.h"
#define ll long long
using namespace std;
//int r,l;
//ll d;
//int x[100005];
int besthub(int R, int L, int X[], long long B)
{
int ans=0;
for(int i=1;i<R-1;i++)
{
int cnt=0;
ll b=B;
priority_queue<ll,vector<ll>,greater<ll>> pq;
for(int j=0;j<R;j++)
pq.push(abs(X[j]-X[i]));
while(!pq.empty())
{
if(b-pq.top()<0)
break;
b-=pq.top();
pq.pop();
cnt++;
}
ans=max(ans,cnt);
}
return ans;
}
//int main()
//{
// cin >> r >> l >> d;
// for(int i=0;i<r;i++)
// cin >> x[i];
// cout << besthub(r,l,x,d);
// return 0;
//}
/**
5 20 6
1 2 10 12 14
**/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 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 |
0 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 |
3 ms |
212 KB |
Output is correct |
22 |
Correct |
4 ms |
212 KB |
Output is correct |
23 |
Correct |
15 ms |
212 KB |
Output is correct |
24 |
Correct |
12 ms |
316 KB |
Output is correct |
25 |
Correct |
13 ms |
212 KB |
Output is correct |
26 |
Correct |
13 ms |
316 KB |
Output is correct |
27 |
Correct |
7 ms |
212 KB |
Output is correct |
28 |
Correct |
8 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
48 ms |
312 KB |
Output is correct |
4 |
Correct |
46 ms |
212 KB |
Output is correct |
5 |
Correct |
3 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
312 KB |
Output is correct |
7 |
Correct |
11 ms |
212 KB |
Output is correct |
8 |
Correct |
12 ms |
212 KB |
Output is correct |
9 |
Correct |
6 ms |
212 KB |
Output is correct |
10 |
Correct |
5 ms |
212 KB |
Output is correct |
11 |
Correct |
13 ms |
212 KB |
Output is correct |
12 |
Correct |
13 ms |
328 KB |
Output is correct |
13 |
Correct |
66 ms |
304 KB |
Output is correct |
14 |
Correct |
57 ms |
316 KB |
Output is correct |
15 |
Correct |
8 ms |
316 KB |
Output is correct |
16 |
Correct |
8 ms |
312 KB |
Output is correct |
17 |
Correct |
40 ms |
212 KB |
Output is correct |
18 |
Correct |
36 ms |
308 KB |
Output is correct |
19 |
Correct |
61 ms |
308 KB |
Output is correct |
20 |
Correct |
58 ms |
308 KB |
Output is correct |
21 |
Correct |
281 ms |
428 KB |
Output is correct |
22 |
Correct |
269 ms |
416 KB |
Output is correct |
23 |
Execution timed out |
1072 ms |
340 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1056 ms |
1740 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |