总目录详见https://blog.csdn.net/mrcrack/article/details/84471041
做题原则,找不到测评地址的题不做。2018-11-28
重走长征路---OI每周刷题记录---11月8日 2014
本周共计38题+题
测评地址:
树形dp:
1.「NOIP模拟赛」LazyChild黑OJ
欧拉图:
2.「NOIP模拟赛」世界人民大团结
字符串:
3.「NOIP模拟赛」擒贼先擒王
dp:
4.「NOIP模拟赛」机房人民大团结
5.「NOIP模拟赛」序列问题
6.「NOIP模拟赛」改造二叉树
7.「NOIP模拟赛」篮球比赛1
贪心:
8.「NOIP模拟赛」盘子序列
9.「codechefFATCHEF」Remy paints the fence
10.「NOIP模拟赛」number
heap:
11.「NOIP模拟赛」点名
12.「codechefPRPOTION」
13.Magical Girl and Colored Liquid Potions
spfa:
14.「NOIP模拟赛」长途旅行
st表+二分:
15.「NOIP模拟赛」数字对
链表:
16.「NOIP模拟赛」字符串
并查集:
17.「NOIP模拟赛」感冒病毒
树状数组:
18.「NOIP模拟赛」弱点
单调队列:
19.「NOIP模拟赛」滑动的窗户 //在线测评地址https://www.luogu.org/problemnew/show/P1886
dfs:
20.「NOIP模拟赛」序列问题(30分)
dfs+bfs:
21.「NOIP模拟赛」密室逃脱
dijkstra:
22.「bzoj2407」探险
dfs+背包dp:
23.「NOIP模拟赛」篮球比赛2(20分)
状压dp:
24.「NOIP模拟赛」篮球比赛2
数学:
25.「NOIP模拟赛」刷漆
26.「NOIP模拟赛」数列
27.「NOIP模拟赛」median
28.「codechefCHEFSEG」Chef and Segment Game
差分约束:
29.「NOIP模拟赛」排队
贪心+bfs:
30.NOIP2010引水入城
二分:
31.NOIP2011聪明的质检员
二分图染色:
32.NOIP2008双栈排序
乘法逆元+快速幂:
33.「NOIP模拟赛」calc
treap+hash:
34.「bzoj2761」[JLOI2011]不重复数字
模拟:
35.「codechefCHEFGR」 Chef and Ground
36.「codechefCHEFLR」Chef and Left-Right
37.「codechefPRPALN」 Let us construct palindrome
map:
38.「codechefDISCHAR」Distinct Characters Subsequence
题解:
树形dp:
1.「NOIP模拟赛」LazyChild黑OJ
欧拉图:
2.「NOIP模拟赛」世界人民大团结
字符串:
3.「NOIP模拟赛」擒贼先擒王
dp:
4.「NOIP模拟赛」机房人民大团结
5.「NOIP模拟赛」序列问题
6.「NOIP模拟赛」改造二叉树
7.「NOIP模拟赛」篮球比赛1
贪心:
8.「NOIP模拟赛」盘子序列
9.「codechefFATCHEF」Remy paints the fence
10.「NOIP模拟赛」number
heap:
11.「NOIP模拟赛」点名
12.「codechefPRPOTION」
13.Magical Girl and Colored Liquid Potions
spfa:
14.「NOIP模拟赛」长途旅行
st表+二分:
15.「NOIP模拟赛」数字对
链表:
16.「NOIP模拟赛」字符串
并查集:
17.「NOIP模拟赛」感冒病毒
树状数组:
18.「NOIP模拟赛」弱点
单调队列:
19.「NOIP模拟赛」滑动的窗户
//P1886 滑动窗口
//在线测评地址https://www.luogu.org/problemnew/show/P1886
//针对 单调队列 作训练,拿该题练练手,进行回忆。
//不断对些错误进行修改,才发现,队列的最后一个元素是q[t-1]而不是q[t]。
//花了点时间,最小值打印成功,应该来说,隔了这么久,能编写成功,单调队列掌握得不错。
//接下来是 最大值 的打印。
//样例通过,提交90分,测试点3WA。2019-4-19
//仔细想了想,忽略了了k=1的情况,马上修改
//测试了k=1的情况,提交AC。2019-4-19
#include <stdio.h>
#define maxn 1000010
int n,k,a[maxn],q[maxn],h,t;//q[h]存储位置
int main(){
int i;
scanf("%d%d",&n,&k);
for(i=1;i<=n;i++)scanf("%d",&a[i]);
h=t=1,q[t]=1,t++;
for(i=1;i<=n;i++){//此处写成for(i=2;i<=n;i++)//处理最小值,数组坐标 中对应的元素自 小到大 排列
while(h<t&&a[q[t-1]]>=a[i])t--;//此处写成while(h<t&&a[q[t]]>=a[i])t--;同样是跟踪代码后才发现//此处写成 while(a[q[t]]>=a[i])t--;
q[t]=i,t++;//i位置必须加入队列
while(h<t&&q[t-1]-q[h]+1>k)h++;//此处写成while(h<t&&t-h>k)h++;跟踪了代码才发现写得有问题//此处写成while(t-h>k)h++;
if(i>=k)printf("%d ",a[q[h]]);
}
printf("\n");
h=t=1,q[t]=1,t++;
for(i=1;i<=n;i++){//此处写成for(i=2;i<=n;i++)//处理最大值,队列中 数组坐标 对应的元素,自大到小排列
while(h<t&&a[q[t-1]]<=a[i])t--;//此处写成 while(h<t&&q[t-1]<=a[i])t--;
q[t]=i,t++;//此处写成 q[t]=a[i],t++;
while(h<t&&q[t-1]-q[h]+1>k)h++;
if(i>=k)printf("%d ",a[q[h]]);
}
printf("\n");
return 0;
}
dfs:
20.「NOIP模拟赛」序列问题(30分)
dfs+bfs:
21.「NOIP模拟赛」密室逃脱
dijkstra:
22.「bzoj2407」探险
dfs+背包dp:
23.「NOIP模拟赛」篮球比赛2(20分)
状压dp:
24.「NOIP模拟赛」篮球比赛2
数学:
25.「NOIP模拟赛」刷漆
26.「NOIP模拟赛」数列
27.「NOIP模拟赛」median
28.「codechefCHEFSEG」Chef and Segment Game
差分约束:
29.「NOIP模拟赛」排队
贪心+bfs:
30.NOIP2010引水入城
二分:
31.NOIP2011聪明的质检员
二分图染色:
32.NOIP2008双栈排序
乘法逆元+快速幂:
33.「NOIP模拟赛」calc
treap+hash:
34.「bzoj2761」[JLOI2011]不重复数字
模拟:
35.「codechefCHEFGR」 Chef and Ground
36.「codechefCHEFLR」Chef and Left-Right
37.「codechefPRPALN」 Let us construct palindrome
map:
38.「codechefDISCHAR」Distinct Characters Subsequence