Submission #206346

# Submission time Handle Problem Language Result Execution time Memory
206346 2020-03-03T03:12:29 Z autumn_eel Roller Coaster Railroad (IOI16_railroad) C++14
34 / 100
80 ms 8572 KB
#include "railroad.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

const ll INF=0x3f3f3f3f3f3f3f3f;

ll dp[1<<16][16];
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    int n = (int) s.size();
    assert(n<=16);
    memset(dp,0x3f,sizeof(dp));
    rep(i,n){
		dp[1<<i][i]=0;
	}
    rep(i,1<<n)rep(j,n){
		if(dp[i][j]==INF)continue;
		rep(k,n){
			if(i>>k&1)continue;
			ll cost=dp[i][j]+max(0,t[j]-s[k]);
			dp[i|1<<k][k]=min(dp[i|1<<k][k],cost);
		}
	}
	return *min_element(dp[(1<<n)-1],dp[(1<<n)-1]+n);
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 8568 KB n = 2
2 Correct 9 ms 8568 KB n = 2
3 Correct 9 ms 8568 KB n = 2
4 Correct 9 ms 8568 KB n = 2
5 Correct 10 ms 8568 KB n = 2
6 Correct 10 ms 8568 KB n = 2
7 Correct 9 ms 8568 KB n = 3
8 Correct 9 ms 8568 KB n = 3
9 Correct 9 ms 8568 KB n = 3
10 Correct 9 ms 8568 KB n = 8
11 Correct 9 ms 8568 KB n = 8
12 Correct 10 ms 8568 KB n = 8
13 Correct 9 ms 8568 KB n = 8
14 Correct 10 ms 8568 KB n = 8
15 Correct 10 ms 8568 KB n = 8
16 Correct 10 ms 8568 KB n = 8
17 Correct 9 ms 8568 KB n = 8
18 Correct 9 ms 8568 KB n = 8
19 Correct 9 ms 8564 KB n = 3
20 Correct 10 ms 8568 KB n = 7
21 Correct 9 ms 8568 KB n = 8
22 Correct 9 ms 8568 KB n = 8
23 Correct 9 ms 8572 KB n = 8
24 Correct 9 ms 8568 KB n = 8
25 Correct 9 ms 8568 KB n = 8
# Verdict Execution time Memory Grader output
1 Correct 9 ms 8568 KB n = 2
2 Correct 9 ms 8568 KB n = 2
3 Correct 9 ms 8568 KB n = 2
4 Correct 9 ms 8568 KB n = 2
5 Correct 10 ms 8568 KB n = 2
6 Correct 10 ms 8568 KB n = 2
7 Correct 9 ms 8568 KB n = 3
8 Correct 9 ms 8568 KB n = 3
9 Correct 9 ms 8568 KB n = 3
10 Correct 9 ms 8568 KB n = 8
11 Correct 9 ms 8568 KB n = 8
12 Correct 10 ms 8568 KB n = 8
13 Correct 9 ms 8568 KB n = 8
14 Correct 10 ms 8568 KB n = 8
15 Correct 10 ms 8568 KB n = 8
16 Correct 10 ms 8568 KB n = 8
17 Correct 9 ms 8568 KB n = 8
18 Correct 9 ms 8568 KB n = 8
19 Correct 9 ms 8564 KB n = 3
20 Correct 10 ms 8568 KB n = 7
21 Correct 9 ms 8568 KB n = 8
22 Correct 9 ms 8568 KB n = 8
23 Correct 9 ms 8572 KB n = 8
24 Correct 9 ms 8568 KB n = 8
25 Correct 9 ms 8568 KB n = 8
26 Correct 11 ms 8568 KB n = 8
27 Correct 10 ms 8568 KB n = 8
28 Correct 9 ms 8568 KB n = 8
29 Correct 41 ms 8568 KB n = 16
30 Correct 41 ms 8568 KB n = 16
31 Correct 45 ms 8568 KB n = 16
32 Correct 41 ms 8568 KB n = 16
33 Correct 41 ms 8568 KB n = 16
34 Correct 41 ms 8572 KB n = 16
35 Correct 42 ms 8568 KB n = 16
36 Correct 23 ms 8572 KB n = 15
37 Correct 9 ms 8568 KB n = 8
38 Correct 42 ms 8568 KB n = 16
39 Correct 40 ms 8568 KB n = 16
40 Correct 9 ms 8568 KB n = 9
41 Correct 40 ms 8568 KB n = 16
42 Correct 40 ms 8568 KB n = 16
43 Correct 40 ms 8568 KB n = 16
44 Correct 9 ms 8568 KB n = 9
45 Correct 26 ms 8568 KB n = 15
46 Correct 40 ms 8568 KB n = 16
47 Correct 41 ms 8568 KB n = 16
48 Correct 40 ms 8568 KB n = 16
# Verdict Execution time Memory Grader output
1 Runtime error 80 ms 6776 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 8568 KB n = 2
2 Correct 9 ms 8568 KB n = 2
3 Correct 9 ms 8568 KB n = 2
4 Correct 9 ms 8568 KB n = 2
5 Correct 10 ms 8568 KB n = 2
6 Correct 10 ms 8568 KB n = 2
7 Correct 9 ms 8568 KB n = 3
8 Correct 9 ms 8568 KB n = 3
9 Correct 9 ms 8568 KB n = 3
10 Correct 9 ms 8568 KB n = 8
11 Correct 9 ms 8568 KB n = 8
12 Correct 10 ms 8568 KB n = 8
13 Correct 9 ms 8568 KB n = 8
14 Correct 10 ms 8568 KB n = 8
15 Correct 10 ms 8568 KB n = 8
16 Correct 10 ms 8568 KB n = 8
17 Correct 9 ms 8568 KB n = 8
18 Correct 9 ms 8568 KB n = 8
19 Correct 9 ms 8564 KB n = 3
20 Correct 10 ms 8568 KB n = 7
21 Correct 9 ms 8568 KB n = 8
22 Correct 9 ms 8568 KB n = 8
23 Correct 9 ms 8572 KB n = 8
24 Correct 9 ms 8568 KB n = 8
25 Correct 9 ms 8568 KB n = 8
26 Correct 11 ms 8568 KB n = 8
27 Correct 10 ms 8568 KB n = 8
28 Correct 9 ms 8568 KB n = 8
29 Correct 41 ms 8568 KB n = 16
30 Correct 41 ms 8568 KB n = 16
31 Correct 45 ms 8568 KB n = 16
32 Correct 41 ms 8568 KB n = 16
33 Correct 41 ms 8568 KB n = 16
34 Correct 41 ms 8572 KB n = 16
35 Correct 42 ms 8568 KB n = 16
36 Correct 23 ms 8572 KB n = 15
37 Correct 9 ms 8568 KB n = 8
38 Correct 42 ms 8568 KB n = 16
39 Correct 40 ms 8568 KB n = 16
40 Correct 9 ms 8568 KB n = 9
41 Correct 40 ms 8568 KB n = 16
42 Correct 40 ms 8568 KB n = 16
43 Correct 40 ms 8568 KB n = 16
44 Correct 9 ms 8568 KB n = 9
45 Correct 26 ms 8568 KB n = 15
46 Correct 40 ms 8568 KB n = 16
47 Correct 41 ms 8568 KB n = 16
48 Correct 40 ms 8568 KB n = 16
49 Runtime error 80 ms 6776 KB Execution killed with signal 11 (could be triggered by violating memory limits)
50 Halted 0 ms 0 KB -