답안 #425826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
425826 2021-06-13T11:44:36 Z temurbek_khujaev Roller Coaster Railroad (IOI16_railroad) C++17
34 / 100
58 ms 10572 KB
#include "railroad.h"
#include <bits/stdc++.h>

const int N = 16;
long long INF = 1e16;
long long dp[1 << N][N];
using namespace std;

long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    int n = (int) s.size();

    for (int mask = 1; mask < (1 << n); mask++) {
        for (int i = 0; i < n; i++) {
            dp[mask][i] = INF;
            if ((mask & (1 << i)) == 0) continue;
            int p_mask = (mask ^ (1 << i));
            if (p_mask == 0) dp[mask][i] = 0;
            for (int j = 0; j < n; j++) {
                if (p_mask & (1 << j)) {
                    dp[mask][i] = min(dp[mask][i], dp[p_mask][j] + max(0, t[j] - s[i]));
                }
            }
        }
    }
    return *min_element(dp[(1 << n) - 1], dp[(1 << n) - 1] + n);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB n = 2
2 Correct 1 ms 204 KB n = 2
3 Correct 1 ms 204 KB n = 2
4 Correct 1 ms 204 KB n = 2
5 Correct 1 ms 204 KB n = 2
6 Correct 1 ms 204 KB n = 2
7 Correct 1 ms 204 KB n = 3
8 Correct 1 ms 204 KB n = 3
9 Correct 1 ms 204 KB n = 3
10 Correct 1 ms 204 KB n = 8
11 Correct 1 ms 332 KB n = 8
12 Correct 1 ms 332 KB n = 8
13 Correct 1 ms 300 KB n = 8
14 Correct 1 ms 332 KB n = 8
15 Correct 1 ms 332 KB n = 8
16 Correct 1 ms 292 KB n = 8
17 Correct 1 ms 296 KB n = 8
18 Correct 1 ms 332 KB n = 8
19 Correct 1 ms 204 KB n = 3
20 Correct 1 ms 204 KB n = 7
21 Correct 1 ms 300 KB n = 8
22 Correct 1 ms 296 KB n = 8
23 Correct 1 ms 304 KB n = 8
24 Correct 1 ms 332 KB n = 8
25 Correct 1 ms 304 KB n = 8
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB n = 2
2 Correct 1 ms 204 KB n = 2
3 Correct 1 ms 204 KB n = 2
4 Correct 1 ms 204 KB n = 2
5 Correct 1 ms 204 KB n = 2
6 Correct 1 ms 204 KB n = 2
7 Correct 1 ms 204 KB n = 3
8 Correct 1 ms 204 KB n = 3
9 Correct 1 ms 204 KB n = 3
10 Correct 1 ms 204 KB n = 8
11 Correct 1 ms 332 KB n = 8
12 Correct 1 ms 332 KB n = 8
13 Correct 1 ms 300 KB n = 8
14 Correct 1 ms 332 KB n = 8
15 Correct 1 ms 332 KB n = 8
16 Correct 1 ms 292 KB n = 8
17 Correct 1 ms 296 KB n = 8
18 Correct 1 ms 332 KB n = 8
19 Correct 1 ms 204 KB n = 3
20 Correct 1 ms 204 KB n = 7
21 Correct 1 ms 300 KB n = 8
22 Correct 1 ms 296 KB n = 8
23 Correct 1 ms 304 KB n = 8
24 Correct 1 ms 332 KB n = 8
25 Correct 1 ms 304 KB n = 8
26 Correct 1 ms 332 KB n = 8
27 Correct 1 ms 332 KB n = 8
28 Correct 1 ms 332 KB n = 8
29 Correct 44 ms 8404 KB n = 16
30 Correct 42 ms 8480 KB n = 16
31 Correct 49 ms 8412 KB n = 16
32 Correct 38 ms 8396 KB n = 16
33 Correct 39 ms 8388 KB n = 16
34 Correct 41 ms 8388 KB n = 16
35 Correct 39 ms 8388 KB n = 16
36 Correct 23 ms 4428 KB n = 15
37 Correct 1 ms 332 KB n = 8
38 Correct 39 ms 8392 KB n = 16
39 Correct 39 ms 8516 KB n = 16
40 Correct 1 ms 332 KB n = 9
41 Correct 40 ms 8392 KB n = 16
42 Correct 40 ms 8408 KB n = 16
43 Correct 39 ms 8384 KB n = 16
44 Correct 1 ms 332 KB n = 9
45 Correct 19 ms 4328 KB n = 15
46 Correct 39 ms 8512 KB n = 16
47 Correct 40 ms 8480 KB n = 16
48 Correct 41 ms 8388 KB n = 16
# 결과 실행 시간 메모리 Grader output
1 Runtime error 58 ms 10572 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB n = 2
2 Correct 1 ms 204 KB n = 2
3 Correct 1 ms 204 KB n = 2
4 Correct 1 ms 204 KB n = 2
5 Correct 1 ms 204 KB n = 2
6 Correct 1 ms 204 KB n = 2
7 Correct 1 ms 204 KB n = 3
8 Correct 1 ms 204 KB n = 3
9 Correct 1 ms 204 KB n = 3
10 Correct 1 ms 204 KB n = 8
11 Correct 1 ms 332 KB n = 8
12 Correct 1 ms 332 KB n = 8
13 Correct 1 ms 300 KB n = 8
14 Correct 1 ms 332 KB n = 8
15 Correct 1 ms 332 KB n = 8
16 Correct 1 ms 292 KB n = 8
17 Correct 1 ms 296 KB n = 8
18 Correct 1 ms 332 KB n = 8
19 Correct 1 ms 204 KB n = 3
20 Correct 1 ms 204 KB n = 7
21 Correct 1 ms 300 KB n = 8
22 Correct 1 ms 296 KB n = 8
23 Correct 1 ms 304 KB n = 8
24 Correct 1 ms 332 KB n = 8
25 Correct 1 ms 304 KB n = 8
26 Correct 1 ms 332 KB n = 8
27 Correct 1 ms 332 KB n = 8
28 Correct 1 ms 332 KB n = 8
29 Correct 44 ms 8404 KB n = 16
30 Correct 42 ms 8480 KB n = 16
31 Correct 49 ms 8412 KB n = 16
32 Correct 38 ms 8396 KB n = 16
33 Correct 39 ms 8388 KB n = 16
34 Correct 41 ms 8388 KB n = 16
35 Correct 39 ms 8388 KB n = 16
36 Correct 23 ms 4428 KB n = 15
37 Correct 1 ms 332 KB n = 8
38 Correct 39 ms 8392 KB n = 16
39 Correct 39 ms 8516 KB n = 16
40 Correct 1 ms 332 KB n = 9
41 Correct 40 ms 8392 KB n = 16
42 Correct 40 ms 8408 KB n = 16
43 Correct 39 ms 8384 KB n = 16
44 Correct 1 ms 332 KB n = 9
45 Correct 19 ms 4328 KB n = 15
46 Correct 39 ms 8512 KB n = 16
47 Correct 40 ms 8480 KB n = 16
48 Correct 41 ms 8388 KB n = 16
49 Runtime error 58 ms 10572 KB Execution killed with signal 11
50 Halted 0 ms 0 KB -