Submission #28756

# Submission time Handle Problem Language Result Execution time Memory
28756 2017-07-16T18:45:20 Z noobprogrammer Boxes with souvenirs (IOI15_boxes) C++14
10 / 100
3 ms 380 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 = l + suf[k] ;
	for(int i = k ; i<n ; i++) res = min(res , pre[i-k] + l + suf[k+1]) ;
	res = min(res , suf[0]) ;
	for(int i=0;i<n;i++) res = min(res , pre[i] + suf[i+1]) ;
	return res ;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 292 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
# 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 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -