답안 #64640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64640 2018-08-05T08:59:32 Z Bodo171 선물상자 (IOI15_boxes) C++14
100 / 100
562 ms 198944 KB
#include "boxes.h"
#include <deque>
#include <iostream>
using namespace std;
const int nmax=10*1000*1000+5;
deque<int> dq;
long long val[nmax],dp[nmax];
int i,poz;
long long delivery(int N, int K, int L, int p[]) {
    for(i=1;i<=N;i++)
    {
        poz=max(i-K,0);
        dp[i]=min(L+dp[poz],2*p[i-1]+dp[poz]);
        val[i]=dp[i-1]+2*(L-p[i-1]);
        if((!dq.empty())&&i-K>=dq.front())
            dq.pop_front();
        while((!dq.empty())&&val[i]<val[dq.back()])
            dq.pop_back();
        dq.push_back(i);
        if(!dq.empty())
            dp[i]=min(dp[i],val[dq.front()]);
    }
    return dp[N];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 292 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 2 ms 252 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 292 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 296 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 292 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 296 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 420 KB Output is correct
33 Correct 51 ms 19896 KB Output is correct
34 Correct 28 ms 19892 KB Output is correct
35 Correct 31 ms 19880 KB Output is correct
36 Correct 51 ms 19836 KB Output is correct
37 Correct 51 ms 19944 KB Output is correct
38 Correct 54 ms 19960 KB Output is correct
39 Correct 48 ms 19960 KB Output is correct
40 Correct 34 ms 19948 KB Output is correct
41 Correct 57 ms 19848 KB Output is correct
42 Correct 34 ms 19960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 292 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 296 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 420 KB Output is correct
33 Correct 51 ms 19896 KB Output is correct
34 Correct 28 ms 19892 KB Output is correct
35 Correct 31 ms 19880 KB Output is correct
36 Correct 51 ms 19836 KB Output is correct
37 Correct 51 ms 19944 KB Output is correct
38 Correct 54 ms 19960 KB Output is correct
39 Correct 48 ms 19960 KB Output is correct
40 Correct 34 ms 19948 KB Output is correct
41 Correct 57 ms 19848 KB Output is correct
42 Correct 34 ms 19960 KB Output is correct
43 Correct 562 ms 198944 KB Output is correct
44 Correct 252 ms 198048 KB Output is correct
45 Correct 278 ms 196020 KB Output is correct
46 Correct 491 ms 198116 KB Output is correct
47 Correct 503 ms 196808 KB Output is correct
48 Correct 514 ms 196036 KB Output is correct
49 Correct 516 ms 198792 KB Output is correct
50 Correct 351 ms 197912 KB Output is correct
51 Correct 533 ms 196004 KB Output is correct
52 Correct 338 ms 196488 KB Output is correct