제출 #993871

#제출 시각아이디문제언어결과실행 시간메모리
993871yellowtoad선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "boxes.h" long long a[10000010], dp[10000010], dpp[10000010], minn = 1e18; long long delivery(int n, int k, int l, int p[]) { for (int i = 1; i <= n; i++) a[i] = p[i-1]; for (int i = 1; i <= n; i++) dp[i] = dp[max(0LL,i-k)]+a[i]*2; for (int i = n; i >= 1; i--) dpp[i] = dpp[min(n+1,i+k)]+(l-a[i])*2; for (int i = 0; i <= n; i++) minn = min(minn,dp[i]+dpp[i+1]); for (int i = 0; i <= n-k; i++) minn = min(minn,dp[i]+dpp[i+k+1]+l); return minn; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:5:42: error: 'max' was not declared in this scope
    5 |  for (int i = 1; i <= n; i++) dp[i] = dp[max(0LL,i-k)]+a[i]*2;
      |                                          ^~~
boxes.cpp:6:44: error: 'min' was not declared in this scope; did you mean 'minn'?
    6 |  for (int i = n; i >= 1; i--) dpp[i] = dpp[min(n+1,i+k)]+(l-a[i])*2;
      |                                            ^~~
      |                                            minn
boxes.cpp:7:38: error: 'min' was not declared in this scope; did you mean 'minn'?
    7 |  for (int i = 0; i <= n; i++) minn = min(minn,dp[i]+dpp[i+1]);
      |                                      ^~~
      |                                      minn
boxes.cpp:8:40: error: 'min' was not declared in this scope; did you mean 'minn'?
    8 |  for (int i = 0; i <= n-k; i++) minn = min(minn,dp[i]+dpp[i+k+1]+l);
      |                                        ^~~
      |                                        minn