Submission #224670

# Submission time Handle Problem Language Result Execution time Memory
224670 2020-04-18T14:44:42 Z Amy313 Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 8988 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{vector<int>V;
	int maxi= 0, c, a;
	long long cp = B;
	for(int i=1; i<=L; i++)
	{
		c = 0;
		cp = B;	

		for(int j=0; j<R; j++)
		{
			a = abs(i-X[j]);
			V.push_back(a);
		}
		sort(V.begin(), V.end());
		for(int j=0; j<V.size(); j++)
		{
			if(V[j]<=cp)
			{
				cp-=V[j];
				c++;
			}
			else
			{
				break;
			}
		}
		if(c>maxi)
		{
			maxi = c;
		}
	}
  return maxi;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:19:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0; j<V.size(); j++)
                ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 1564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 8988 KB Time limit exceeded
2 Halted 0 ms 0 KB -