답안 #299398

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
299398 2020-09-14T20:32:51 Z williamMBDK Shortcut (IOI16_shortcut) C++11
0 / 100
1 ms 384 KB
#include<bits/stdc++.h>
#include "shortcut.h"
using namespace std;
#define int long long
int N, C;
vector<signed> L, D;
int find_shortcut(signed _N, std::vector<signed> _l, std::vector<signed> _d, signed _C){
	L = _l, D = _d;	
	N = _N;
	C = _C;
	vector<pair<int,int>> dp (N);
	pair<int,int> best = {0, -1};
	for(int i = N - 1; i >= 0; i--){
		dp[i] = best;
		dp[i].first += D[i];
		if(i == 0) break;
		if(D[i] >= best.first){
			best = {D[i], i};
		}
		best.first += L[i-1];
	}
	best = {0,-1};
	int idx = -1;
	for(int i = 0; i < N; i++){
		if(dp[i] > best) best = dp[i], idx = i;
	}
	vector<int> dist (N);
	for(int i = 1; i < N; i++){
		dist[i] = dist[i-1] + L[i-1];
	}
	int a = idx, b = best.second;
	//cout << a << " " << b << endl;
	//cout << best.first << endl;
	int res = LLONG_MAX;
	for(int i = 0; i < N; i++){
		for(int k = i+1; k < N; k++){
			int mx = 0;
			for(int j = 0; j < N - 1; j++){
				int d = dp[j].first; // fine?
				int worst = dp[j].second;
				//cout << j << " " << worst << " " << dp[j].first << endl;
				d = min(d, D[j] + abs(dist[j] - dist[i]) + C + D[worst] + abs(dist[worst] - dist[k]));
				mx = max(d, mx);
			}
			res = min(res, mx);
		}
	}
	return res;
}

Compilation message

shortcut.cpp: In function 'long long int find_shortcut(int, std::vector<int>, std::vector<int>, int)':
shortcut.cpp:31:6: warning: unused variable 'a' [-Wunused-variable]
   31 |  int a = idx, b = best.second;
      |      ^
shortcut.cpp:31:15: warning: unused variable 'b' [-Wunused-variable]
   31 |  int a = idx, b = best.second;
      |               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB n = 4, 80 is a correct answer
2 Correct 0 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Correct 0 ms 384 KB n = 3, 4 is a correct answer
5 Correct 1 ms 256 KB n = 2, 62 is a correct answer
6 Correct 1 ms 256 KB n = 2, 3 is a correct answer
7 Correct 1 ms 256 KB n = 3, 29 is a correct answer
8 Correct 1 ms 256 KB n = 2, 3 is a correct answer
9 Correct 0 ms 256 KB n = 2, 3 is a correct answer
10 Correct 0 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 256 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 256 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 256 KB n = 4, 4000000000 is a correct answer
16 Incorrect 1 ms 256 KB n = 5, incorrect answer: jury 4000000000 vs contestant 3000000001
17 Halted 0 ms 0 KB -