Submission #224636

# Submission time Handle Problem Language Result Execution time Memory
224636 2020-04-18T14:18:59 Z Amy313 Rice Hub (IOI11_ricehub) C++14
0 / 100
20 ms 768 KB
#include "ricehub.h"
#include<bits/stdc++.h>
int besthub(int R, int L, int X[], long long B)
{
	int r, maxi= -1, cp = B, c, a;
	for(int i=0; i<R; i++)
	{
		c = 0;
		r = i;
		cp = B;
		for(int j=0; j<R; j++)
		{
			a = abs(X[i]-X[j]);
			if(a<=cp)
			{
				cp-=a;
				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:5:6: warning: variable 'r' set but not used [-Wunused-but-set-variable]
  int r, maxi= -1, cp = B, c, a;
      ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 256 KB Output is correct
14 Incorrect 4 ms 256 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 6 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Incorrect 4 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Incorrect 20 ms 768 KB Output isn't correct
4 Halted 0 ms 0 KB -