Submission #96646

# Submission time Handle Problem Language Result Execution time Memory
96646 2019-02-10T15:16:46 Z figter001 Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
2 ms 376 KB
#include "boxes.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int maxn = 1e6+50;

ll pre[maxn],suf[maxn];

long long delivery(int n, int k, int l, int p[]) {
	for(int i=0;i<n;i++){
		pre[i] = 2*p[i];
		if(i >= k)pre[i] += pre[i-k];
	}
	for(int i=n-1;i>=0;i--){
		suf[i] = 2ll*(n - p[i]);
		if(i + k < n)suf[i] += suf[i+k];
	}
	ll ans = suf[0];
	for(int i=0;i<n;i++){
		ans = min(ans,pre[i] + n + suf[i+k+1]);
		ans = min(ans,pre[i] + suf[i+1]);
	}
	return ans;
}

Compilation message

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:11:38: warning: unused parameter 'l' [-Wunused-parameter]
 long long delivery(int n, int k, int l, int p[]) {
                                      ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 276 KB Output isn't correct
3 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 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -