제출 #1195726

#제출 시각아이디문제언어결과실행 시간메모리
1195726nikulid선물상자 (IOI15_boxes)C++20
10 / 100
0 ms328 KiB
#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 subtask New Lemma: the second subtask does not use dp. hence I will only move on to q2 after solving the first two subtasks */ long long delivery(int N, int K, int L, int p[]) { vector<int> ns; ns = {0}; for(int i=0; i<N; i++){ ns.push_back(p[i]); } ll ans=0; int biggest_gap=L-ns[N-1]; for(int i=1; i<N+1; i++){ biggest_gap = max(biggest_gap, ns[i]-ns[i-1]); } /* ll cur, furthest=0; for(auto e:ns){ cur = min(e, L-e); ans += 2*cur; furthest = max(cur, furthest); } */ return min(L, (L-biggest_gap)*2); }
#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...