Submission #153525

# Submission time Handle Problem Language Result Execution time Memory
153525 2019-09-14T12:44:34 Z songc Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
#include "boxes.h"
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

int N, M, K;
int A[1010101];
LL L[1010101], R[1010101], ans=(1ll<<61);

LL delivery(int n, int m, int k, int a[]){
    N = n, M = m, K = k;
    for (int i=1; i<=N; i++) A[i] = a[i-1];
    for (int i=1; i<=N; i++){
        if (i%M == 1) L[i] = L[i-1]+min(A[i]*2, K);
        else L[i] = L[i-1]-min(A[(i-1)/M*M+1]*2, K)+min(A[i]*2, K);
    }
    for (int i=1; i<=N/2; i++) swap(A[i], A[N-i+1]);
    for (int i=1; i<=N; i++){
        if (i%M == 1) R[i] = R[i-1]+min((K-A[i])*2, K);
        else R[i] = R[i-1]-min((K-A[(i-1)/M*M+1])*2, K)+min((K-A[i])*2, K);
    }
    for (int i=0; i<=N; i++) ans = min(ans, L[i]+R[N-i]);
    return ans;
}
# 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 -
# 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 -