제출 #813081

#제출 시각아이디문제언어결과실행 시간메모리
813081Kerim선물상자 (IOI15_boxes)C++17
10 / 100
1 ms212 KiB
#include "boxes.h" #include "bits/stdc++.h" using namespace std; #define ll long long long long delivery(int n, int k, int l, int p[]) { vector<int> arr(n+2); arr[n+1] = l; for (int i = 1; i <= n; i++) arr[i] = p[i-1]; ll answer = 0; if (k == 1){//subtask1 for (int i = 1; i <= n; i++) answer += 2LL * min(arr[i], l - arr[i]); } else if(k == n){//subtask2 answer = l; for (int i = 0; i + 1 <= n; i++) answer = min(answer, 2LL * (arr[i] + l - arr[i+1])); } return answer; }
#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...