#include "ricehub.h"
#include <algorithm>
#include <vector>
using namespace std;
vector < long long > all;
int besthub(int R, int L, int X[], long long B)
{
long long now=0,ans=0,i,j;
for(i=0;i<R;i++)
{
all.clear();
for(j=0;j<R;j++) all.push_back((long long) abs(X[j]-X[i]));
sort(all.begin(),all.end());
now=0;
for(j=0;j<R;j++)
{
///printf("%d %lld\n",i,all[j]);
if(now+all[j]>B) break;
now+=all[j];
}
ans=max(ans,j);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
492 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
0 ms |
364 KB |
Output is correct |
12 |
Correct |
0 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
376 KB |
Output is correct |
14 |
Correct |
0 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
0 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Correct |
1 ms |
364 KB |
Output is correct |
21 |
Correct |
3 ms |
364 KB |
Output is correct |
22 |
Correct |
4 ms |
364 KB |
Output is correct |
23 |
Correct |
6 ms |
364 KB |
Output is correct |
24 |
Correct |
6 ms |
364 KB |
Output is correct |
25 |
Correct |
6 ms |
364 KB |
Output is correct |
26 |
Correct |
6 ms |
364 KB |
Output is correct |
27 |
Correct |
6 ms |
364 KB |
Output is correct |
28 |
Correct |
7 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
20 ms |
364 KB |
Output is correct |
4 |
Correct |
20 ms |
364 KB |
Output is correct |
5 |
Correct |
3 ms |
364 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
13 ms |
364 KB |
Output is correct |
8 |
Correct |
13 ms |
492 KB |
Output is correct |
9 |
Correct |
6 ms |
364 KB |
Output is correct |
10 |
Correct |
7 ms |
364 KB |
Output is correct |
11 |
Correct |
15 ms |
364 KB |
Output is correct |
12 |
Correct |
15 ms |
364 KB |
Output is correct |
13 |
Correct |
25 ms |
364 KB |
Output is correct |
14 |
Correct |
25 ms |
364 KB |
Output is correct |
15 |
Correct |
6 ms |
364 KB |
Output is correct |
16 |
Correct |
6 ms |
364 KB |
Output is correct |
17 |
Correct |
15 ms |
364 KB |
Output is correct |
18 |
Correct |
15 ms |
364 KB |
Output is correct |
19 |
Correct |
24 ms |
364 KB |
Output is correct |
20 |
Correct |
24 ms |
364 KB |
Output is correct |
21 |
Correct |
437 ms |
748 KB |
Output is correct |
22 |
Correct |
421 ms |
520 KB |
Output is correct |
23 |
Correct |
847 ms |
620 KB |
Output is correct |
24 |
Correct |
866 ms |
528 KB |
Output is correct |
25 |
Correct |
796 ms |
620 KB |
Output is correct |
26 |
Correct |
787 ms |
620 KB |
Output is correct |
27 |
Correct |
717 ms |
536 KB |
Output is correct |
28 |
Correct |
741 ms |
536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1090 ms |
876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |