Submission #418529

# Submission time Handle Problem Language Result Execution time Memory
418529 2021-06-05T13:00:07 Z saleh Shortcut (IOI16_shortcut) C++17
0 / 100
1 ms 204 KB
#include "shortcut.h"
#include <bits/stdc++.h>

#define int long long

using namespace std;


long long find_shortcut(int32_t n, vector<int32_t> l, vector<int32_t> d, int32_t c) {
	if (n > 100) return 8;
	int dis[n * 2][n * 2];
	for (int i = 0; i < n * 2; i++) for (int j = 0; j < n * 2; j++) if (i != j) dis[i][j] = 1e13;
	for (int i = 0; i < n - 1; i++) dis[2 * i][2 * i + 2] = dis[2 * i + 2][2 * i] = l[i];
	for (int i = 0; i < n; i++) dis[2 * i][2 * i + 1] = dis[2 * i + 1][2 * i] = d[i];
	for (int k = 0; k < n; k++) for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
	int ans = 1e13;
	for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
		int jav = 0;
		for (int a = 0; a < n; a++) for (int b = a + 1; b < n; b++)
			jav = max(jav, min({dis[a * 2 + 1][b * 2 + 1], dis[a * 2 + 1][i * 2] + dis[j * 2][b * 2 + 1] + c, dis[a * 2 + 1][j * 2] + dis[i * 2][b * 2 + 1] + c}));
		ans = min(ans, jav);
	}
    return ans;
}

//int32_t main() {}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB n = 4, incorrect answer: jury 80 vs contestant 10000000000000
2 Halted 0 ms 0 KB -