Educational Codeforces Round 69 题解 题目编号 A B C D E F 完成情况 √ √ √ ★ ★ - D. Yet Another Subarray Problem 一个子数组的价值为: \[\sum_{i=l}^{r} a[i] - k\lceil{\frac{r-l+1}{m}}\rceil\] 求解其最大值.子数组可以为空,此时价值为0. \(r-l+1\)自然是子数组的长度\(len\),可以发现每当\(len\)增加\(m\)后,\(\lceil{\…
D. Yet Another Subarray Problem You are given an array \(a_1, a_2, \dots , a_n\) and two integers \(m\) and \(k\). You can choose some subarray \(a_l, a_{l+1}, \dots, a_{r-1}, a_r\). The cost of subarray \(a_l, a_{l+1}, \dots, a_{r-1}, a_r\) is equal…
目录 Contest Info Solutions A. DIY Wooden Ladder B. Pillars C. Array Splitting D. Yet Another Subarray Problem E. Culture Code Contest Info Practice Link Solved A B C D E F 5/6 O O O O Ø - O 在比赛中通过 Ø 赛后通过 ! 尝试了但是失败了 - 没有尝试 Solutions A. DIY Wooden Ladde…
#include<bits/stdc++.h>using namespace std;int a[300007];long long sum[300007],tmp[300007],mx[300007];int main(){ int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;++i){ cin>>a[i]; sum[i]=sum[i-1]+a[i];//前缀和 } long long ans=0; for…