제출 #1316123

#제출 시각아이디문제언어결과실행 시간메모리
1316123khanhphucscratch선물상자 (IOI15_boxes)C++20
10 / 100
0 ms332 KiB
#include "boxes.h" #include<bits/stdc++.h> #define int long long using namespace std; int delivery(int32_t n, int32_t k, int32_t len, int32_t p[]) { int l = 0, r = n-1; int ans = 0; while(l < n && p[l] == 0) l++; while(l <= r){ if(r-l+1 <= k){ ans += 2*min(len-p[l], p[r]); break; } else{ if(len-p[r-k+1] < p[l+k-1]){ ans += 2*(len-p[r-k+1]); r -= k; } else{ ans += 2*p[l+k-1]; l += k; } } } 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...