제출 #1203376

#제출 시각아이디문제언어결과실행 시간메모리
1203376AMel0n선물상자 (IOI15_boxes)C++20
0 / 100
1 ms324 KiB
// this prob not working #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), dpR(N); FOR(i, N) { if (p[i] <= N / 2) { for(ll j = 1; j <= K; j++) { if (i >= j) dpL[i] = max(dpL[i], dpL[i-j] + 2 * p[i]); else dpL[i] = max(dpL[i], 2ll * p[i]); // cout << "L " << i << ' ' << j << ' ' << dpL[i] << endl; } } else { for(ll j = 1; j <= K; j++) { if (i + j <= N) dpR[N-i] = max(dpR[N-1], dpR[N-i-j] + 2 * p[N-i]); else dpR[N-i] = max(dpR[N-1], 2ll * p[N-i]); // cout << "R " << i << ' ' << j << ' ' << dpR[i] << endl; } } } ll mx = -1; FOR(i, N) mx = max({mx, dpL[i], dpR[i]}); return mx; } // 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...