제출 #923179

#제출 시각아이디문제언어결과실행 시간메모리
923179Macker선물상자 (IOI15_boxes)C++14
20 / 100
1 ms500 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(v) v.begin(), v.end() long long delivery(int N, int K, int L, int p[]) { ll n = N; ll k = K; ll l = L; vector<ll> v(p, p + N); ll dist = 0; ll s = 0, e = n; for (ll i = k - 1; i < n && v[i] <= l / 2; i += k) { dist += 2 * v[i]; s = i + 1; } for (ll i = n - k; i >= 0 && v[i] > l / 2; i -= k) { dist += 2 * (l - v[i]); e = i; } ll a = 0; for (ll i = s; i < n && v[i] <= l / 2; i++) { a = 2 * v[i]; } ll b = 0; for (ll i = e - 1; i >= 0 && v[i] > l / 2; i--) { b = 2 * (l - v[i]); } if(e - s <= k) return dist + min(l, a + b); else return dist + a + b; }
#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...