====== 2020/07/25 – 2020/07/31 周报 ======
===== 团队训练 =====
* [[niukediwuchang00|牛客多校第五场]] ''%%pro: 5/6/11%%'' ''%%rk: 54/1145%%''
* [[niukediliuchang00|牛客多校第六场]] ''%%pro: 5/5/11%%'' ''%%rk: 92/1120%%''
===== 李英龙 =====
==== 专题 ====
[[https://blog.csdn.net/dragonylee/article/details/107660418|生成函数]]
==== 比赛 ====
* [[https://blog.csdn.net/dragonylee/article/details/107707121|Codeforces Round #660 (Div. 2)]] ''%%pro: 4/4/5%%'' ''%%rk: 963/18771%%''
* [[https://blog.csdn.net/dragonylee/article/details/107711732|M-SOLUTIONS Programming Contest 2020]] ''%%pro: 6/6%%'' ''%%rk: NaN%%'' **FINISHED**
==== 题目 ====
无
===== 陈源 =====
==== 专题 ====
[[swdp_cy|数位dp]]
==== 比赛 ====
* [[cf660_cy|Codeforces Round #660 (Div. 2)]] ''%%pro: 3/4/5%%'' ''%%rk: 1572/18771%%''
==== 题目 ====
无
===== 胡琎 =====
==== 专题 ====
无
==== 比赛 ====
* [[2020-2021:teams:too_low:cf659_hj|Codeforces Round #659 (Div. 2)]] ''%%pro: 2/4/7%%'' ''%%rank 2380/10822%%''
* [[2020-2021:teams:too_low:cfedu92hj|Educational Codeforces Round 92]] ''%%pro: 4/4/7%%'' ''%%rank 989/13827%%''
==== 题目 ====
无
===== 本周推荐 =====
==== 李英龙 ====
[[https://blog.csdn.net/dragonylee/article/details/107660418|生成函数的一些总结]]
==== 陈源 ====
[[swdp_cy|数位dp小结]]
==== 胡琎 ====
CF 659 B2 Koa and the Beach (Hard Version)
[[https://codeforces.com/contest/1384/problem/B2]]
** 题意 ** 需要从海滩游到海岛上,给定初始时波浪高度等于0时的水深分布,波浪高度在0-k-0-k之间连续变动,已知最深能够游的水深D,求是否可以游到小岛
** 题解 ** 设波浪高度为k-0-k,维护到达位置i时,可能的波浪时间范围[l, r]。位置i+1时,波浪的范围为[l+1, r+1]和 [k - (D - d[i]), k + (D - d[i])]的交,如果长度为0则不可游到。特别的,如果D大于d[i]+k则时间范围为[0,2k-1],即整个长度
特别要注意D - d[i]小于0的情况。这里pretest没有测结果B2 System test的时候WA了
** Tag ** dp
** Comment ** 这道题需要基于位置思考,而不是基于时间思考,因为波浪的变化是周期性有规律的,便于处理,而水深的变化是任意的。
#include
using namespace std;
int d[300005];
int main(){
int t = 0;
cin>>t;
while(t--){
int n, k, l;
cin>>n>>k>>l;
for (int i = 1; i <= n; ++i) {
cin>>d[i];
}
int t1 = 0, t2 = 2*k-1;
bool ok = true;
for (int i = 1; i <= n; ++i) {
if(l - d[i] >= k){
t1 = 0, t2 = 2*k-1;
}
else{
if(l < d[i]){
ok = false;break;
}
int tt1 = k - (l - d[i]);
int tt2 = k + (l - d[i]);
t1++, t2++;
if(tt2 < t1 || tt1 > t2) {
ok = false;
break;
}
t1 = max(tt1, t1);
t2 = min(tt2, t2);
}
}
cout<<(ok ? "Yes" : "No")<