제출 #331092

#제출 시각아이디문제언어결과실행 시간메모리
331092Pety선물상자 (IOI15_boxes)C++14
0 / 100
9 ms492 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; const int N = 10000002; long long dp[N], dp2[N]; long long delivery (int n, int k, int l, int poz[]) { for (int i = n; i >= 1; i--) poz[i] = poz[i - 1]; ///oof for (int i = 1; i <= n; i++) dp[i] = (i >= k ? dp[i - k] + 2 * poz[i] : 2 * poz[i]); for (int i = n; i >= 1; i--) dp2[i] = (i <= n - k ? dp2[i + k] + 2 * (l - poz[i]) : 2 * (l - poz[i])); long long ans = 0; for (int i = 0; i <= n; i++) ans =max(ans, dp[i] + dp2[i + 1]); for (int i = 0; i <= n - k; i++) ans = max(ans, dp[i] + dp2[i + k + 1] + l); 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...