Submission #65276

# Submission time Handle Problem Language Result Execution time Memory
65276 2018-08-07T09:35:38 Z KHUSRAV Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
3 ms 376 KB
#include "boxes.h"
#include<bits/stdc++.h>
using namespace std ;
pair<long long , long long> dppred[10000001] , dpfirst[10000001];
long long delivery(int N, int K, int L, int p[]) {
    int l = 0 ;
    int r = N - 1 ;
    long long ans = 1e18 ;
    while(l + 1 < r){
        int m = (l + r) / 2 ;
        if(p[m] <= L / 2) l = m ;
        else r = m ;
    }
    for(int i = 0 ; i <= N ; i ++){
        long long s = 0 ;
        for(int j = l ; j >=0 ; j -= K)
            s = s + 2 * p[j];
        for(int j = r ; j < N ; j += K)
            s = s + 2 * (L - p[j]);
        ans = min(ans , i * L + s);
        for(int j = 1 ; j <= K ; j ++){
            if(l >= 0 && r < N){
                if(L / 2 - p[l] <= p[r] - L / 2){
                    l -- ;
                }
                else r ++ ;
            }
            else if(l >= 0)
                l -- ;
            else if(r < N)
                r ++ ;
        }
    }
    return ans ;
}
# 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 3 ms 376 KB Output is correct
2 Correct 3 ms 372 KB Output is correct
3 Incorrect 3 ms 348 KB Output isn't correct
4 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 256 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 256 KB Output isn't correct
2 Halted 0 ms 0 KB -