제출 #420306

#제출 시각아이디문제언어결과실행 시간메모리
420306Azimjon선물상자 (IOI15_boxes)C++17
10 / 100
1 ms204 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; const int INF = 2e9; long long delivery(int n, int k, int L, int p[]) { long long ans = 0; double ur = L / 2; int m; for (m = 0; m < n; m++) if (p[m] > ur) break; int l = m - 1; int r = m; // cout << l << " " << r << endl; while (1) { if (l - k + 1 >= 0) { ans += 2 * p[l]; l -= k; } else break; } while (1) { if (r + k - 1 < n) { ans += 2 * (L - p[r]); r += k; } else break; } 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...