제출 #431832

#제출 시각아이디문제언어결과실행 시간메모리
431832muhammad_hokimiyon선물상자 (IOI15_boxes)C++14
50 / 100
2072 ms24068 KiB
#include "boxes.h" #include <bits/stdc++.h> #define fi first #define se second #define ll long long #define dl double using namespace std; ll delivery(int N, int K, int L, int P[]) { vector<ll> d(N + 1, 1e18); d[0] = 0; vector<ll> p(N + 1, 0); for(int i = 1; i <= N; i++)p[i] = P[i - 1]; sort(p.begin(), p.end()); auto go = [&](int i, int j) -> ll{ ll res = 1e18; res = abs(p[i] - p[j]); return min(res, L - res); }; for(int i = 1; i <= N; i++){ for(int j = i; j >= 1; j--){ if(i - j + 1 > K)break; long long cost = L; cost = min(cost, p[i] * 2); cost = min(cost, (L - p[j]) * 2); d[i] = min(d[i], d[j - 1] + cost); } } return d[N]; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:18:14: warning: variable 'go' set but not used [-Wunused-but-set-variable]
   18 |         auto go = [&](int i, int j) -> ll{
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...