## 답안 #712512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
712512 2023-03-19T00:53:07 Z Username4132 선물상자 (IOI15_boxes) C++14
0 / 100
1 ms 340 KB
```#include "boxes.h"
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;
#define forn(i, n) for(int i=0; i<(int)n; ++i)

const int MAXN=10000010;
int le[MAXN], ri[MAXN], cnl=0, cnr=0;
ll dpl[MAXN], dpr[MAXN];

long long delivery(int N, int K, int L, int p[]) {

forn(i, N){
if(p[i]<(L>>1)) le[cnl++]=p[i];
else ri[cnr++]=L-p[i];
}

forn(i, cnl){
if(i<K) dpl[i]=le[i];
else dpl[i]=dpl[i-K]+le[i];
}
forn(i, cnr){
if(i<K) dpr[i]=ri[i];
else dpr[i]=dpr[i-K]+ri[i];
}

ll ans = (dpl[cnl-1]+dpr[cnr-1])<<1;
forn(i, K+1){
ans = min(ans, (dpl[cnl-1-i] + dpr[cnr-1-K+i])<<1 + L);
}

return ans;
}```

### Compilation message

```boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:30:59: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
30 |         ans = min(ans, (dpl[cnl-1-i] + dpr[cnr-1-K+i])<<1 + L);
|                                                         ~~^~~```

#### Subtask #1 0 / 10.0

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #2 0 / 10.0

# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #3 0 / 15.0

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #4 0 / 15.0

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #5 0 / 20.0

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #6 0 / 30.0

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -