Submission #206381

# Submission time Handle Problem Language Result Execution time Memory
206381 2020-03-03T07:19:56 Z TAISA_ Shortcut (IOI16_shortcut) C++14
0 / 100
5 ms 632 KB
#include "shortcut.h"
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll INF=1LL<<60;
long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c)
{
	vector<ll> sum(n);
	for(int i=0;i<n;i++){
		sum[i+1]=sum[i]+l[i];
	}
	ll mi=INF;
	auto dist=[&](int u,int v){return u<v?sum[v+1]-sum[u+1]:sum[u+1]-sum[v+1];};
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			ll ma=0;
			for(int k=0;k<n;k++){
				for(int l=k+1;l<n;l++){
					ll s=d[k]+d[l]+dist(k,l);
					s=min(s,dist(i,k)+dist(j,l)+c+d[k]+d[l]);
					ma=max(ma,s);
				}
			}
			mi=min(mi,ma);
		}
	}
    return mi;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB n = 4, 80 is a correct answer
2 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -