답안 #418273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418273 2021-06-05T08:57:44 Z Maqsut_03 쌀 창고 (IOI11_ricehub) C++14
17 / 100
123 ms 800 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;

int besthub(int R, int L, int X[], long long B)
{
	int ans = 0, m;
	for (int i=0; i<R; i++)
	{
		int sum = 1, b = B, j = i;
		int 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:11:23: warning: unused variable 'j' [-Wunused-variable]
   11 |   int sum = 1, b = B, j = i;
      |                       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 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 0 ms 300 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 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 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 1 ms 304 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 308 KB Output is correct
27 Incorrect 1 ms 304 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 312 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 272 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 2 ms 204 KB Output is correct
14 Correct 2 ms 312 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 6 ms 460 KB Output is correct
3 Incorrect 123 ms 800 KB Output isn't correct
4 Halted 0 ms 0 KB -