Submission #128263

# Submission time Handle Problem Language Result Execution time Memory
128263 2019-07-10T15:31:21 Z ekrem Shortcut (IOI16_shortcut) C++
0 / 100
2 ms 380 KB
#include "shortcut.h"
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000000000000009
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;
typedef vector < int > vi;

ll n, c, x, y, ans = inf, pre[N];
vi a, d;

ll bul(int i, int j){
	return d[i] + d[j] + min(pre[j] - pre[i], abs(pre[x]-pre[i]) + abs(pre[y]-pre[j]) + c);
}

ll find_shortcut(int nn, vi l, vi dd, int cc){n = nn;c = cc;
	a = l;d = dd;
	for(int i = 0; i < n - 1; i++)
		pre[i + 1] = pre[i] + a[i];
	for(x = 0; x < n; x++)
		for(y = x + 1; y < n; y++){
			ll mx = 0;
			for(int i = 0; i < n; i++)
				for(int j = 0; j < n; j++)
					mx = max(mx, bul(i, j));
			ans = min(ans, mx);
		}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB n = 4, 80 is a correct answer
2 Correct 2 ms 376 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 2 ms 252 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -