제출 #666285

#제출 시각아이디문제언어결과실행 시간메모리
666285jamezzz선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "boxes.h"

#define LINF 1023456789123456789
typedef long long ll;
#define maxn 10000005

ll pfx[maxn], sfx[maxn];

ll delivery(int N, int K, int L, int p[]){
    sort(p, p + N);
    for (int i = 0; i < N; ++i) {
        sfx[i % K] += L - p[i];
    }
    ll ans = LINF;
    for (int i = 0; i < N; ++i) {
        pfx[i % K] += p[i];
        sfx[i % K] -= L - p[i];
        ans = min(ans, pfx[i % K] * 2 + sfx[(i + 1) % K] * 2);
    }
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |     sort(p, p + N);
      |     ^~~~
      |     short
boxes.cpp:18:15: error: 'min' was not declared in this scope
   18 |         ans = min(ans, pfx[i % K] * 2 + sfx[(i + 1) % K] * 2);
      |               ^~~