답안 #49753

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
49753 2018-06-02T17:51:21 Z gs13105 쌀 창고 (IOI11_ricehub) C++17
49 / 100
24 ms 11896 KB
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
#include "ricehub.h"

using namespace std;

int besthub(int R, int L, int X[], long long B)
{
    int p = 0, q = 0, res = 0;
    long long c = 0;
    for(int i = 0; i < R; i++)
    {
        if(i)
            c += 1LL * ((i - p) - (q - i)) * (X[i] - X[i - 1]);

        while(c > B)
            c -= X[i] - X[p++];

        while(q < R && (X[q] - X[i] <= X[i] - X[p] || c + X[q] - X[i] <= B))
        {
            c += X[q++] - X[i];
            while(c > B)
                c -= X[i] - X[p++];
        }

        res = max(res, q - p);
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 640 KB Output is correct
14 Correct 2 ms 640 KB Output is correct
15 Correct 2 ms 640 KB Output is correct
16 Correct 2 ms 640 KB Output is correct
17 Correct 2 ms 640 KB Output is correct
18 Correct 2 ms 640 KB Output is correct
19 Correct 2 ms 640 KB Output is correct
20 Correct 2 ms 640 KB Output is correct
21 Correct 2 ms 640 KB Output is correct
22 Correct 2 ms 640 KB Output is correct
23 Correct 2 ms 640 KB Output is correct
24 Correct 2 ms 640 KB Output is correct
25 Correct 2 ms 640 KB Output is correct
26 Correct 2 ms 640 KB Output is correct
27 Incorrect 2 ms 640 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 3 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 3 ms 640 KB Output is correct
15 Correct 2 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Correct 3 ms 640 KB Output is correct
18 Incorrect 3 ms 640 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 5 ms 640 KB Output is correct
3 Correct 17 ms 896 KB Output is correct
4 Correct 17 ms 1144 KB Output is correct
5 Correct 8 ms 1144 KB Output is correct
6 Correct 11 ms 1276 KB Output is correct
7 Correct 16 ms 2176 KB Output is correct
8 Correct 16 ms 2964 KB Output is correct
9 Correct 8 ms 2964 KB Output is correct
10 Correct 8 ms 3272 KB Output is correct
11 Correct 19 ms 4584 KB Output is correct
12 Correct 20 ms 5656 KB Output is correct
13 Correct 10 ms 5780 KB Output is correct
14 Correct 10 ms 6208 KB Output is correct
15 Correct 17 ms 7164 KB Output is correct
16 Correct 15 ms 7824 KB Output is correct
17 Correct 19 ms 8948 KB Output is correct
18 Correct 24 ms 10008 KB Output is correct
19 Correct 19 ms 10972 KB Output is correct
20 Correct 19 ms 11896 KB Output is correct