답안 #206381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -