| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 65283 | KHUSRAV | 선물상자 (IOI15_boxes) | C++14 | 3 ms | 376 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "boxes.h"
#include<bits/stdc++.h>
using namespace std ;
long long delivery(int N, int K, int L, int p[]) {
    int l = -1 ;
    int r = N ;
    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];
            if(p[j] > L / 2){
                cout << 1 / 0 ;
            }
        }
        for(int j = r ; j < N ; j += K){
            s = s + 2 * (L - p[j]);
            if(p[j] <= L / 2){
                cout << 1 / 0 ;
            }
        }
        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 ;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
