답안 #928539

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928539 2024-02-16T15:40:09 Z AlphaMale06 선물상자 (IOI15_boxes) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
long long dp[10000003], rdp[10000003];
long long delivery(int n, int k, int l, int a[]) {
    sort(a, a+n);
    for(int i=1; i<= n; i++)dp[i]=dp[i-min(i, k)]+min(l, 2*a[i-1]);
    for(int i=n; i>=1; i--)rdp[i]=rdp[i+min(n+1-i, k)]+min(l, 2*(l-a[i-1]));
    ll ans=min(rdp[1], dp[n]);
    for(int i=1; i<n; i++)ans=min(ans, dp[i]+rdp[i+1]);
    return ans;
}

Compilation message

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:8:5: error: 'll' was not declared in this scope; did you mean 'l'?
    8 |     ll ans=min(rdp[1], dp[n]);
      |     ^~
      |     l
boxes.cpp:9:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     for(int i=1; i<n; i++)ans=min(ans, dp[i]+rdp[i+1]);
      |                           ^~~
      |                           abs
boxes.cpp:10:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     return ans;
      |            ^~~
      |            abs