답안 #28859

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28859 2017-07-17T11:07:53 Z kavun 쌀 창고 (IOI11_ricehub) C++14
68 / 100
1000 ms 104080 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#include "ricehub.h"

using namespace std;
typedef long long ll;
int dp[5010][5010];

int pr(int i, int j, int X[])
{
    if(dp[i][j])
        return dp[i][j];
    if(i == j)
        return 0;
    if(j == i+1)
        return X[j] - X[i];
    int median = i + (j-i)/2;
    dp[i][j] = pr(i+1,j-1,X) - X[i] + X[j];
    return dp[i][j];
}

int besthub(int R, int L, int X[], long long B)
{
    for(int res = R; res > 0; res--)
    {
        for(int i = 0; i <= R - res; i++)
        {
            ll cost = pr(i,i+res-1,X);
            if(cost <= B)
                return res;
        }
    }
}

Compilation message

ricehub.cpp: In function 'int pr(int, int, int*)':
ricehub.cpp:17:9: warning: unused variable 'median' [-Wunused-variable]
     int median = i + (j-i)/2;
         ^
ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 103972 KB Output is correct
2 Correct 0 ms 103972 KB Output is correct
3 Correct 0 ms 103972 KB Output is correct
4 Correct 0 ms 103972 KB Output is correct
5 Correct 0 ms 103972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 103972 KB Output is correct
2 Correct 0 ms 103972 KB Output is correct
3 Correct 0 ms 103972 KB Output is correct
4 Correct 0 ms 103972 KB Output is correct
5 Correct 0 ms 103972 KB Output is correct
6 Correct 0 ms 103972 KB Output is correct
7 Correct 0 ms 103972 KB Output is correct
8 Correct 0 ms 103972 KB Output is correct
9 Correct 0 ms 103972 KB Output is correct
10 Correct 0 ms 103972 KB Output is correct
11 Correct 0 ms 103972 KB Output is correct
12 Correct 0 ms 103972 KB Output is correct
13 Correct 0 ms 103972 KB Output is correct
14 Correct 0 ms 103972 KB Output is correct
15 Correct 0 ms 103972 KB Output is correct
16 Correct 0 ms 103972 KB Output is correct
17 Correct 0 ms 103972 KB Output is correct
18 Correct 0 ms 103972 KB Output is correct
19 Correct 0 ms 103972 KB Output is correct
20 Correct 0 ms 103972 KB Output is correct
21 Correct 3 ms 103972 KB Output is correct
22 Correct 3 ms 103972 KB Output is correct
23 Correct 0 ms 103972 KB Output is correct
24 Correct 0 ms 103972 KB Output is correct
25 Correct 0 ms 103972 KB Output is correct
26 Correct 0 ms 103972 KB Output is correct
27 Correct 0 ms 103972 KB Output is correct
28 Correct 3 ms 103972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 103972 KB Output is correct
2 Correct 0 ms 103972 KB Output is correct
3 Correct 0 ms 103972 KB Output is correct
4 Correct 0 ms 103972 KB Output is correct
5 Correct 3 ms 103972 KB Output is correct
6 Correct 3 ms 103972 KB Output is correct
7 Correct 19 ms 103972 KB Output is correct
8 Correct 16 ms 103972 KB Output is correct
9 Correct 3 ms 103972 KB Output is correct
10 Correct 3 ms 103972 KB Output is correct
11 Correct 9 ms 103972 KB Output is correct
12 Correct 9 ms 103972 KB Output is correct
13 Correct 0 ms 103972 KB Output is correct
14 Correct 0 ms 103972 KB Output is correct
15 Correct 0 ms 103972 KB Output is correct
16 Correct 3 ms 103972 KB Output is correct
17 Correct 0 ms 103972 KB Output is correct
18 Correct 0 ms 103972 KB Output is correct
19 Correct 0 ms 103972 KB Output is correct
20 Correct 0 ms 103972 KB Output is correct
21 Correct 779 ms 103972 KB Output is correct
22 Correct 756 ms 103972 KB Output is correct
23 Correct 3 ms 103972 KB Output is correct
24 Correct 3 ms 103972 KB Output is correct
25 Correct 6 ms 103972 KB Output is correct
26 Correct 6 ms 103972 KB Output is correct
27 Correct 359 ms 103972 KB Output is correct
28 Correct 359 ms 103972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 104080 KB Execution timed out
2 Halted 0 ms 0 KB -