#include "boxes.h"
#include <vector>
#include <math.h>
using namespace std;
#define ll long long
/*
Lemma:
this is dp and I will move on to q2 after getting the first sub task
*/
long long delivery(int N, int K, int L, int p[]) {
vector<int> ns;
for(int i=0; i<N; i++){
ns.push_back(p[i]);
}
ll ans=0;
int cur, furthest=0;
for(auto e:ns){
cur = min(e, L-e+1);
ans += cur;
furthest = max(cur, furthest);
}
return 2*ans - furthest;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |