Submission #1203375

#TimeUsernameProblemLanguageResultExecution timeMemory
1203375AMel0nBoxes with souvenirs (IOI15_boxes)C++20
0 / 100
2 ms396 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), dpR(N); FOR(i, N) { if (p[i] <= N / 2) { for(int j = 1; j <= K; j++) { if (i >= j) dpL[i] += dpL[i-j] + 2 * p[i]; else dpL[i] += 2 * p[i]; // cout << "L " << i << ' ' << j << ' ' << dpL[i] << endl; } } else { for(int j = 1; j <= K; j++) { if (i + j <= N) dpR[N-i] = dpR[N-i-j] + 2 * p[N-i]; else dpR[N-i] += 2 * 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...