Submission #1203383

#TimeUsernameProblemLanguageResultExecution timeMemory
1203383AMel0n선물상자 (IOI15_boxes)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i,N) for(ll i = 0; i < N; i++) #define all(x) (x).begin(), (x).end() // #define F first // #define S second #include "boxes.h" ll delivery(int N, int K, int L, int p[]) { vector<ll> dpL(N, INT_MAX), dpR(N, INT_MAX); FOR(i, N) { if (p[i] <= L / 2) { // for(ll j = 1; j <= K; j++) { // if (i >= j) dpL[i] = min(dpL[i], dpL[i-j] + 2ll * p[i]); // else dpL[i] = min(dpL[i], 2ll * p[i]); // cout << "L " << i << ' ' << j << ' ' << dpL[i] << endl; // } if (i >= K) dpL[i] = min(dpL[i], dpL[i-K] + 2ll * p[i]); else dpL[i] = min(dpL[i], 2ll * p[i]); // cout << "L " << i << ' ' << dpL[i] << endl; } else { // for(ll j = 1; j <= K; j++) { // if (i + j <= N) dpR[N-i] = min(dpR[N-i], dpR[N-i-j] + 2ll * (N - p[N-i])); // else dpR[N-i] = min(dpR[N-i], 2ll * (N - p[N-i])); // cout << "R " << i << ' ' << j << ' ' << dpR[i] << endl; // } if (i + K <= N) dpR[N-i] = min(dpR[N-i], dpR[N-i-K] + 2ll * (L - p[i])); else dpR[N-i] = min(dpR[N-i], 2ll * (L - p[i])); // cout << "R " << i << ' ' << dpR[N-i] << ' ' << 2ll * (L - p[i]) << endl; } } ll mxL = 0, mxR = 0; FOR(i, N) { if (dpL[i] != INT_MAX) mxL = max(mxL, dpL[i]); if (dpR[i] != INT_MAX) mxR = max(mxR, dpR[i]); } return mxL + mxR; } // signed main() { // cin.tie(0); ios::sync_with_stdio(false); // }
#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...