# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
807478 | 2023-08-04T17:56:37 Z | happypotato | Roller Coaster Railroad (IOI16_railroad) | C++17 | 280 ms | 524288 KB |
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define int long long vector<int> s, t; int n; int BruteDP() { int dp[(1 << n)][n]; for (int conf = 0; conf < (1 << n); conf++) { for (int i = 0; i < n; i++) { dp[conf][i] = (conf == (1 << i) ? 0 : 1e18); } } for (int bit = 2; bit <= n; bit++) { for (int conf = 0; conf < (1 << n); conf++) { if (__builtin_popcountll(conf) != bit) continue; for (int i = 0; i < n; i++) { if (conf & (1 << i)) { for (int j = 0; j < n; j++) { if (!bool(conf & (1 << j)) || i == j) continue; // cerr << "UPDATE " << conf << ' ' << i << ' ' << j << ' ' << dp[conf ^ (1 << i)][j] << ' '; // cerr << t[j] << ' ' << s[i] << endl; dp[conf][i] = min(dp[conf][i], dp[conf ^ (1 << i)][j] + max(0LL, t[j] - s[i])); } } } } } // for (int i = 0; i < (1 << n); i++) { // for (int j = 0; j < n; j++) cerr << dp[i][j] << ' '; // cerr << endl; // } int ans = 1e18; for (int i = 0; i < n; i++) ans = min(ans, dp[(1 << n) - 1][i]); return ans; } long long plan_roller_coaster(vector<int32_t> S, vector<int32_t> T) { n = S.size(); s.resize(n); t.resize(n); for (int i = 0; i < n; i++) { s[i] = S[i]; t[i] = T[i]; } // for (int i = 0; i < n; i++) cerr << s[i] << ' '; cerr << endl; // for (int i = 0; i < n; i++) cerr << t[i] << ' '; cerr << endl; if (n <= 16) return BruteDP(); } #undef int
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 0 ms | 212 KB | n = 2 |
3 | Correct | 1 ms | 300 KB | n = 2 |
4 | Correct | 0 ms | 300 KB | n = 2 |
5 | Correct | 0 ms | 212 KB | n = 2 |
6 | Correct | 1 ms | 212 KB | n = 2 |
7 | Correct | 0 ms | 212 KB | n = 3 |
8 | Correct | 1 ms | 300 KB | n = 3 |
9 | Correct | 0 ms | 212 KB | n = 3 |
10 | Correct | 1 ms | 212 KB | n = 8 |
11 | Correct | 1 ms | 212 KB | n = 8 |
12 | Correct | 1 ms | 296 KB | n = 8 |
13 | Correct | 1 ms | 212 KB | n = 8 |
14 | Correct | 1 ms | 296 KB | n = 8 |
15 | Correct | 1 ms | 300 KB | n = 8 |
16 | Correct | 1 ms | 212 KB | n = 8 |
17 | Correct | 1 ms | 212 KB | n = 8 |
18 | Correct | 1 ms | 212 KB | n = 8 |
19 | Correct | 1 ms | 212 KB | n = 3 |
20 | Correct | 1 ms | 212 KB | n = 7 |
21 | Correct | 1 ms | 300 KB | n = 8 |
22 | Correct | 1 ms | 212 KB | n = 8 |
23 | Correct | 1 ms | 340 KB | n = 8 |
24 | Correct | 1 ms | 212 KB | n = 8 |
25 | Correct | 1 ms | 212 KB | n = 8 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 0 ms | 212 KB | n = 2 |
3 | Correct | 1 ms | 300 KB | n = 2 |
4 | Correct | 0 ms | 300 KB | n = 2 |
5 | Correct | 0 ms | 212 KB | n = 2 |
6 | Correct | 1 ms | 212 KB | n = 2 |
7 | Correct | 0 ms | 212 KB | n = 3 |
8 | Correct | 1 ms | 300 KB | n = 3 |
9 | Correct | 0 ms | 212 KB | n = 3 |
10 | Correct | 1 ms | 212 KB | n = 8 |
11 | Correct | 1 ms | 212 KB | n = 8 |
12 | Correct | 1 ms | 296 KB | n = 8 |
13 | Correct | 1 ms | 212 KB | n = 8 |
14 | Correct | 1 ms | 296 KB | n = 8 |
15 | Correct | 1 ms | 300 KB | n = 8 |
16 | Correct | 1 ms | 212 KB | n = 8 |
17 | Correct | 1 ms | 212 KB | n = 8 |
18 | Correct | 1 ms | 212 KB | n = 8 |
19 | Correct | 1 ms | 212 KB | n = 3 |
20 | Correct | 1 ms | 212 KB | n = 7 |
21 | Correct | 1 ms | 300 KB | n = 8 |
22 | Correct | 1 ms | 212 KB | n = 8 |
23 | Correct | 1 ms | 340 KB | n = 8 |
24 | Correct | 1 ms | 212 KB | n = 8 |
25 | Correct | 1 ms | 212 KB | n = 8 |
26 | Correct | 1 ms | 300 KB | n = 8 |
27 | Correct | 1 ms | 212 KB | n = 8 |
28 | Correct | 1 ms | 212 KB | n = 8 |
29 | Correct | 41 ms | 8484 KB | n = 16 |
30 | Correct | 38 ms | 8404 KB | n = 16 |
31 | Correct | 38 ms | 8404 KB | n = 16 |
32 | Correct | 41 ms | 8500 KB | n = 16 |
33 | Correct | 40 ms | 8492 KB | n = 16 |
34 | Correct | 37 ms | 8484 KB | n = 16 |
35 | Correct | 39 ms | 8404 KB | n = 16 |
36 | Correct | 17 ms | 4136 KB | n = 15 |
37 | Correct | 1 ms | 212 KB | n = 8 |
38 | Correct | 38 ms | 8384 KB | n = 16 |
39 | Correct | 43 ms | 8484 KB | n = 16 |
40 | Correct | 1 ms | 212 KB | n = 9 |
41 | Correct | 39 ms | 8492 KB | n = 16 |
42 | Correct | 42 ms | 8488 KB | n = 16 |
43 | Correct | 38 ms | 8488 KB | n = 16 |
44 | Correct | 1 ms | 384 KB | n = 9 |
45 | Correct | 19 ms | 4064 KB | n = 15 |
46 | Correct | 38 ms | 8484 KB | n = 16 |
47 | Correct | 37 ms | 8484 KB | n = 16 |
48 | Correct | 46 ms | 8480 KB | n = 16 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 280 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 0 ms | 212 KB | n = 2 |
3 | Correct | 1 ms | 300 KB | n = 2 |
4 | Correct | 0 ms | 300 KB | n = 2 |
5 | Correct | 0 ms | 212 KB | n = 2 |
6 | Correct | 1 ms | 212 KB | n = 2 |
7 | Correct | 0 ms | 212 KB | n = 3 |
8 | Correct | 1 ms | 300 KB | n = 3 |
9 | Correct | 0 ms | 212 KB | n = 3 |
10 | Correct | 1 ms | 212 KB | n = 8 |
11 | Correct | 1 ms | 212 KB | n = 8 |
12 | Correct | 1 ms | 296 KB | n = 8 |
13 | Correct | 1 ms | 212 KB | n = 8 |
14 | Correct | 1 ms | 296 KB | n = 8 |
15 | Correct | 1 ms | 300 KB | n = 8 |
16 | Correct | 1 ms | 212 KB | n = 8 |
17 | Correct | 1 ms | 212 KB | n = 8 |
18 | Correct | 1 ms | 212 KB | n = 8 |
19 | Correct | 1 ms | 212 KB | n = 3 |
20 | Correct | 1 ms | 212 KB | n = 7 |
21 | Correct | 1 ms | 300 KB | n = 8 |
22 | Correct | 1 ms | 212 KB | n = 8 |
23 | Correct | 1 ms | 340 KB | n = 8 |
24 | Correct | 1 ms | 212 KB | n = 8 |
25 | Correct | 1 ms | 212 KB | n = 8 |
26 | Correct | 1 ms | 300 KB | n = 8 |
27 | Correct | 1 ms | 212 KB | n = 8 |
28 | Correct | 1 ms | 212 KB | n = 8 |
29 | Correct | 41 ms | 8484 KB | n = 16 |
30 | Correct | 38 ms | 8404 KB | n = 16 |
31 | Correct | 38 ms | 8404 KB | n = 16 |
32 | Correct | 41 ms | 8500 KB | n = 16 |
33 | Correct | 40 ms | 8492 KB | n = 16 |
34 | Correct | 37 ms | 8484 KB | n = 16 |
35 | Correct | 39 ms | 8404 KB | n = 16 |
36 | Correct | 17 ms | 4136 KB | n = 15 |
37 | Correct | 1 ms | 212 KB | n = 8 |
38 | Correct | 38 ms | 8384 KB | n = 16 |
39 | Correct | 43 ms | 8484 KB | n = 16 |
40 | Correct | 1 ms | 212 KB | n = 9 |
41 | Correct | 39 ms | 8492 KB | n = 16 |
42 | Correct | 42 ms | 8488 KB | n = 16 |
43 | Correct | 38 ms | 8488 KB | n = 16 |
44 | Correct | 1 ms | 384 KB | n = 9 |
45 | Correct | 19 ms | 4064 KB | n = 15 |
46 | Correct | 38 ms | 8484 KB | n = 16 |
47 | Correct | 37 ms | 8484 KB | n = 16 |
48 | Correct | 46 ms | 8480 KB | n = 16 |
49 | Runtime error | 280 ms | 524288 KB | Execution killed with signal 9 |
50 | Halted | 0 ms | 0 KB | - |