Submission #614925

# Submission time Handle Problem Language Result Execution time Memory
614925 2022-07-31T05:35:09 Z Shithila Rice Hub (IOI11_ricehub) C++14
68 / 100
1000 ms 512 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
	int dis[R];
	int pos=0;
	long long max=0;
  	for(int k=0;k<R;k++)
  	{
  		int i=X[k];
  		for(int j=0;j<R;j++)
  		{
  			dis[j]=abs(i-X[j]);
		}
		sort(dis,dis+R);
		long long sum=0;
		int j=0;
		while(sum<=B && j<R)
		{
			sum=sum+dis[j];
			j++;
		}
		if(sum>B)j--;
		
		if(pos<j)
		{
			pos=j;
		}
		//cout<<i<<" "<<j<<endl;
  	}	
  	return pos;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:8:12: warning: unused variable 'max' [-Wunused-variable]
    8 |  long long max=0;
      |            ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 0 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 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
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 1 ms 312 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 0 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 3 ms 212 KB Output is correct
23 Correct 6 ms 308 KB Output is correct
24 Correct 5 ms 212 KB Output is correct
25 Correct 5 ms 316 KB Output is correct
26 Correct 7 ms 212 KB Output is correct
27 Correct 5 ms 308 KB Output is correct
28 Correct 5 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 20 ms 320 KB Output is correct
4 Correct 17 ms 312 KB Output is correct
5 Correct 3 ms 308 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 15 ms 316 KB Output is correct
8 Correct 12 ms 212 KB Output is correct
9 Correct 5 ms 212 KB Output is correct
10 Correct 5 ms 212 KB Output is correct
11 Correct 12 ms 212 KB Output is correct
12 Correct 13 ms 320 KB Output is correct
13 Correct 21 ms 316 KB Output is correct
14 Correct 23 ms 312 KB Output is correct
15 Correct 5 ms 212 KB Output is correct
16 Correct 7 ms 312 KB Output is correct
17 Correct 14 ms 212 KB Output is correct
18 Correct 12 ms 212 KB Output is correct
19 Correct 23 ms 212 KB Output is correct
20 Correct 19 ms 316 KB Output is correct
21 Correct 317 ms 344 KB Output is correct
22 Correct 341 ms 352 KB Output is correct
23 Correct 742 ms 368 KB Output is correct
24 Correct 670 ms 360 KB Output is correct
25 Correct 647 ms 364 KB Output is correct
26 Correct 627 ms 360 KB Output is correct
27 Correct 562 ms 360 KB Output is correct
28 Correct 570 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -