제출 #783256

#제출 시각아이디문제언어결과실행 시간메모리
783256Matblube선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include <iostream> #include <iomanip> #include <string> #include <math.h> #include <algorithm> #include <cstring> #include <numeric> #include <vector> #include <map> #include <set> #include <deque> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; #define dbg(x) cerr<<#x<<": "<<x<<"\n"; #define fr(i, x) for(ll i=0 ; i<x ; i++) #define fra(x, v) for(auto x:v) #define fra1(x,v) for(auto &x:v) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define pb(x) push_back(x) #define F first #define S second long long delivery(int N, int K, int L, int p[]) { ll n=N, k=K, l=L; vector<ll>v(n+1); fr(i, n) v[i+1]=p[i]; dp[1]=dp1[n]=0; for(ll i=1; i <=n ; i++) dp[i]+=(2*v[i])+dp[i-1]; for(ll i=n-1 ; i>0 ; i--) dp1[i]+=(2*(l-v[i]))+dp1[i+1]; return min(dp1[1], dp[n]); return 0; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:32:5: error: 'dp' was not declared in this scope; did you mean 'p'?
   32 |     dp[1]=dp1[n]=0;
      |     ^~
      |     p
boxes.cpp:32:11: error: 'dp1' was not declared in this scope
   32 |     dp[1]=dp1[n]=0;
      |           ^~~
boxes.cpp:29:13: warning: unused variable 'k' [-Wunused-variable]
   29 |     ll n=N, k=K, l=L;
      |             ^