Submission #88584

# Submission time Handle Problem Language Result Execution time Memory
88584 2018-12-06T20:44:57 Z amiratou Roller Coaster Railroad (IOI16_railroad) C++14
11 / 100
2000 ms 9452 KB
#include "railroad.h"
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
using namespace std;
int n;
bool used[200003];
vector<int> li,exi;
long long solve(long long speed,long long idx,long long rails){
	//debug(rails);
	//debugs(speed,idx);
	if(idx==n)
		return rails;
	long long ans=INF;
	for (int i = 0; i < n; ++i)
	{
		if(!used[i]){
			used[i]=1;
			//debug(i);
			ans=min(ans,solve(exi[i],idx+1,rails+max(0LL,speed-li[i])));
			used[i]=0;
		}

	}
	return ans;
}
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    n = (int) s.size();
    li=s;
    exi=t;
    return solve(1,0,0);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB n = 2
2 Correct 2 ms 372 KB n = 2
3 Correct 2 ms 372 KB n = 2
4 Correct 0 ms 408 KB n = 2
5 Correct 2 ms 468 KB n = 2
6 Correct 2 ms 544 KB n = 2
7 Correct 2 ms 560 KB n = 3
8 Correct 2 ms 560 KB n = 3
9 Correct 2 ms 560 KB n = 3
10 Correct 4 ms 560 KB n = 8
11 Correct 3 ms 560 KB n = 8
12 Correct 3 ms 560 KB n = 8
13 Correct 4 ms 560 KB n = 8
14 Correct 3 ms 560 KB n = 8
15 Correct 4 ms 560 KB n = 8
16 Correct 4 ms 560 KB n = 8
17 Correct 4 ms 560 KB n = 8
18 Correct 4 ms 560 KB n = 8
19 Correct 2 ms 616 KB n = 3
20 Correct 2 ms 628 KB n = 7
21 Correct 3 ms 628 KB n = 8
22 Correct 4 ms 628 KB n = 8
23 Correct 3 ms 628 KB n = 8
24 Correct 4 ms 628 KB n = 8
25 Correct 4 ms 628 KB n = 8
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB n = 2
2 Correct 2 ms 372 KB n = 2
3 Correct 2 ms 372 KB n = 2
4 Correct 0 ms 408 KB n = 2
5 Correct 2 ms 468 KB n = 2
6 Correct 2 ms 544 KB n = 2
7 Correct 2 ms 560 KB n = 3
8 Correct 2 ms 560 KB n = 3
9 Correct 2 ms 560 KB n = 3
10 Correct 4 ms 560 KB n = 8
11 Correct 3 ms 560 KB n = 8
12 Correct 3 ms 560 KB n = 8
13 Correct 4 ms 560 KB n = 8
14 Correct 3 ms 560 KB n = 8
15 Correct 4 ms 560 KB n = 8
16 Correct 4 ms 560 KB n = 8
17 Correct 4 ms 560 KB n = 8
18 Correct 4 ms 560 KB n = 8
19 Correct 2 ms 616 KB n = 3
20 Correct 2 ms 628 KB n = 7
21 Correct 3 ms 628 KB n = 8
22 Correct 4 ms 628 KB n = 8
23 Correct 3 ms 628 KB n = 8
24 Correct 4 ms 628 KB n = 8
25 Correct 4 ms 628 KB n = 8
26 Correct 4 ms 628 KB n = 8
27 Correct 4 ms 628 KB n = 8
28 Correct 4 ms 628 KB n = 8
29 Execution timed out 2041 ms 628 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 9452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB n = 2
2 Correct 2 ms 372 KB n = 2
3 Correct 2 ms 372 KB n = 2
4 Correct 0 ms 408 KB n = 2
5 Correct 2 ms 468 KB n = 2
6 Correct 2 ms 544 KB n = 2
7 Correct 2 ms 560 KB n = 3
8 Correct 2 ms 560 KB n = 3
9 Correct 2 ms 560 KB n = 3
10 Correct 4 ms 560 KB n = 8
11 Correct 3 ms 560 KB n = 8
12 Correct 3 ms 560 KB n = 8
13 Correct 4 ms 560 KB n = 8
14 Correct 3 ms 560 KB n = 8
15 Correct 4 ms 560 KB n = 8
16 Correct 4 ms 560 KB n = 8
17 Correct 4 ms 560 KB n = 8
18 Correct 4 ms 560 KB n = 8
19 Correct 2 ms 616 KB n = 3
20 Correct 2 ms 628 KB n = 7
21 Correct 3 ms 628 KB n = 8
22 Correct 4 ms 628 KB n = 8
23 Correct 3 ms 628 KB n = 8
24 Correct 4 ms 628 KB n = 8
25 Correct 4 ms 628 KB n = 8
26 Correct 4 ms 628 KB n = 8
27 Correct 4 ms 628 KB n = 8
28 Correct 4 ms 628 KB n = 8
29 Execution timed out 2041 ms 628 KB Time limit exceeded
30 Halted 0 ms 0 KB -