Submission #28755

# Submission time Handle Problem Language Result Execution time Memory
28755 2017-07-16T18:43:07 Z noobprogrammer Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
2 ms 372 KB
#include "boxes.h"
#include <bits/stdc++.h> 
using namespace std ;
#define ii pair<int,int>
#define fi first
#define se second
#define vi vector<int>
#define vii vector<ii>
typedef long long ll ;

ll pre[10000010] , suf[10000010] ;

long long delivery(int n, int k, int L , int arr[]) {
	ll l = L ;
	for(int i=0;i<n;i++){
		if(i <= k) pre[i] = 2*arr[i] ;
		else pre[i] = 2*arr[i] + pre[i-k] ;
	}
	for(int i=n-1; i >= 0 ;i--){
		if(n - i - 1 <= k) suf[i] = 2*(l - arr[i]) ;
		else suf[i] = suf[i+k] + 2* (l-arr[i]) ;
	}
	ll res = 1e18 ;
	for(int i = k ; i<n ; i++) res = min(res , pre[i-k] + l + suf[k+1]) ;
	return res ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -