답안 #49755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
49755 2018-06-02T18:01:29 Z gs13105 쌀 창고 (IOI11_ricehub) C++17
49 / 100
23 ms 1024 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>

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)
        {
            assert(p < R);
            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];
            if(c > B)
            {
                assert(p < R);
                c -= X[i] - X[p++];
                assert(c <= B);
            }
        }

        assert(c <= B && p <= i && i < q);
        res = max(res, q - p);
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 3 ms 488 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 564 KB Output is correct
2 Correct 2 ms 564 KB Output is correct
3 Correct 2 ms 564 KB Output is correct
4 Correct 2 ms 576 KB Output is correct
5 Correct 3 ms 576 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 2 ms 576 KB Output is correct
8 Correct 2 ms 620 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Correct 2 ms 620 KB Output is correct
11 Correct 2 ms 620 KB Output is correct
12 Correct 2 ms 620 KB Output is correct
13 Correct 2 ms 620 KB Output is correct
14 Correct 2 ms 620 KB Output is correct
15 Correct 2 ms 620 KB Output is correct
16 Correct 2 ms 620 KB Output is correct
17 Correct 2 ms 620 KB Output is correct
18 Correct 2 ms 620 KB Output is correct
19 Correct 2 ms 620 KB Output is correct
20 Correct 2 ms 620 KB Output is correct
21 Correct 2 ms 620 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 3 ms 620 KB Output is correct
25 Correct 3 ms 620 KB Output is correct
26 Correct 3 ms 620 KB Output is correct
27 Incorrect 2 ms 620 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 620 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
4 Correct 2 ms 620 KB Output is correct
5 Correct 2 ms 620 KB Output is correct
6 Correct 3 ms 620 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 2 ms 636 KB Output is correct
9 Correct 2 ms 636 KB Output is correct
10 Correct 2 ms 636 KB Output is correct
11 Correct 2 ms 636 KB Output is correct
12 Correct 3 ms 636 KB Output is correct
13 Correct 2 ms 636 KB Output is correct
14 Correct 2 ms 636 KB Output is correct
15 Correct 2 ms 636 KB Output is correct
16 Correct 2 ms 636 KB Output is correct
17 Correct 2 ms 636 KB Output is correct
18 Incorrect 2 ms 636 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 636 KB Output is correct
2 Correct 4 ms 636 KB Output is correct
3 Correct 16 ms 1020 KB Output is correct
4 Correct 17 ms 1020 KB Output is correct
5 Correct 9 ms 1020 KB Output is correct
6 Correct 8 ms 1020 KB Output is correct
7 Correct 14 ms 1020 KB Output is correct
8 Correct 15 ms 1020 KB Output is correct
9 Correct 8 ms 1020 KB Output is correct
10 Correct 7 ms 1020 KB Output is correct
11 Correct 22 ms 1020 KB Output is correct
12 Correct 23 ms 1024 KB Output is correct
13 Correct 12 ms 1024 KB Output is correct
14 Correct 10 ms 1024 KB Output is correct
15 Correct 14 ms 1024 KB Output is correct
16 Correct 15 ms 1024 KB Output is correct
17 Correct 16 ms 1024 KB Output is correct
18 Correct 20 ms 1024 KB Output is correct
19 Correct 18 ms 1024 KB Output is correct
20 Correct 18 ms 1024 KB Output is correct