제출 #795133

#제출 시각아이디문제언어결과실행 시간메모리
795133Ronin13Boxes with souvenirs (IOI15_boxes)C++17
100 / 100
452 ms293660 KiB
#include "boxes.h" #include <bits/stdc++.h> #define ll long long #define ull unsigned ll #define f first #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define epb emplace_back using namespace std; long long delivery(int N, int K, int L, int p[]) { ll a[N], b[N]; int n= N; for(int i = 0; i < n; i++){ if(i < K) a[i] = p[i] + min(p[i], L - p[i]); else a[i] = a[i - K] + p[i] + min(p[i], L - p[i]); } for(int i = n - 1; i >= 0; i--){ if(i + K < n) b[i] = b[i + K] + L - p[i] + min(p[i], L - p[i]); else b[i] = L - p[i] + min(p[i], L - p[i]);; } ll ans = min(a[n - 1], b[0]); for(int i = 0; i < n - 1; i++){ ans = min(ans, a[i] + b[i + 1]); } return ans ; }
#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...