답안 #24501

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
24501 2017-06-09T12:35:11 Z Donghyun Kim(#1043) Shortcut (IOI16_shortcut) C++14
0 / 100
0 ms 4024 KB
#include "shortcut.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n;
ll c, a[505], s[505], m[505][505], ans = 1e18;

ll find_shortcut(int N, vector<int> l, vector<int> d, int C) {
	n = N; c = C;
	for(int i = 1; i <= n; i++) a[i] = d[i - 1];
	for(int i = 2; i <= n; i++) s[i] = s[i - 1] + l[i - 2];
    for(int i = 1; i <= n; i++){
		m[i][i] = a[i] + s[i];
		for(int j = i + 1; j <= n; j++){
			m[i][j] = max(m[i][j - 1], a[j] + s[j]);
		}
    }
    for(int x = 1; x <= n; x++){
		for(int y = x + 1; y <= n; y++){
			ll cans = 0, pm = 0;
			for(int i = x; i <= y; i++){
				pm = max(pm, a[i] + min(c + s[y] - s[i], s[i] - s[x]));
			}
			for(int i = x; i <= y; i++){
				for(int j = x + 1; j <= y; j++){
					cans = max(cans, a[i] + a[j] + min(s[j] - s[i], c + s[y] - s[j] + s[i] - s[x]));
				}
			}
            for(int i = 1; i < x; i++){
				cans = max(cans, m[i + 1][x - 1] + a[i] - s[i]);
				cans = max(cans, pm + a[i] + s[x] - s[i]);
				cans = max(cans, s[x] - s[i] + min(c, s[y] - s[x]) + m[y + 1][n] - s[y] + a[i]);
            }
            for(int i = x; i <= y; i++){
				cans = max(cans, min(c + s[i] - s[x], s[y] - s[i]) + m[y + 1][n] - s[y] + a[i]);
            }
            for(int i = y + 1; i <= n; i++){
				cans = max(cans, m[i + 1][n] + a[i] - s[i]);
            }
            ans = min(ans, cans);
		}
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4024 KB n = 4, 80 is a correct answer
2 Correct 0 ms 4024 KB n = 9, 110 is a correct answer
3 Correct 0 ms 4024 KB n = 4, 21 is a correct answer
4 Correct 0 ms 4024 KB n = 3, 4 is a correct answer
5 Correct 0 ms 4024 KB n = 2, 62 is a correct answer
6 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
7 Correct 0 ms 4024 KB n = 3, 29 is a correct answer
8 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
9 Correct 0 ms 4024 KB n = 2, 3 is a correct answer
10 Correct 0 ms 4024 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 4024 KB n = 2, 3000000000 is a correct answer
12 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 4024 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 4024 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 4024 KB n = 4, 4000000000 is a correct answer
16 Correct 0 ms 4024 KB n = 5, 4000000000 is a correct answer
17 Incorrect 0 ms 4024 KB n = 10, incorrect answer: jury 1000000343 vs contestant 1000000358
18 Halted 0 ms 0 KB -