제출 #1034063

#제출 시각아이디문제언어결과실행 시간메모리
1034063Zicrus선물상자 (IOI15_boxes)C++17
20 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll delivery(int n, int k, int l, int p11[]) { vector<ll> p(n); for (int i = 0; i < n; i++) p[i] = p11[i]; if (k == 1) { ll sum = 0; for (auto &e : p) sum += 2*min(e, l-e); return sum; } ll fR = lower_bound(p.begin(), p.end(), l/2) - p.begin(); if (fR == 0) return 2*(l-p[fR]); ll fL = fR-1; if (fL == n-1) return 2*p[fL]; return p[fL] + l-p[fR] + min(p[fR]-p[fL], l-(p[fR]-p[fL])); }
#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...