Submission #418274

# Submission time Handle Problem Language Result Execution time Memory
418274 2021-06-05T08:59:38 Z Maqsut_03 Rice Hub (IOI11_ricehub) C++14
17 / 100
1000 ms 644 KB
#include "ricehub.h"
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const int M = 1e9 + 7;

int besthub(int R, int L, int X[], long long B)
{
	ll ans = 0, m;
	for (int i=0; i<R; i++)
	{
		ll sum = 1, b = B, j = i;
		ll l = i - 1, r = i + 1;
		while (1)
		{
			if (r < R && l >= 0 && X[i] - X[l] <= X[r] - X[i]) m = X[i] - X[l], l--;
			else if (r < R) m = X[r] - X[i], r++;
			else break;
			if (m > b) break;
			else sum++, b -= m;
		}
		ans = max(ans, sum);
	}
    return ans;
} 

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:12:22: warning: unused variable 'j' [-Wunused-variable]
   12 |   ll sum = 1, b = B, j = i;
      |                      ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 2 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Incorrect 1 ms 204 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 3 ms 204 KB Output is correct
14 Correct 3 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 3 ms 204 KB Output is correct
18 Incorrect 3 ms 204 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 332 KB Output is correct
2 Correct 7 ms 332 KB Output is correct
3 Execution timed out 1089 ms 644 KB Time limit exceeded
4 Halted 0 ms 0 KB -