2020.08.07【NOIP提高组】模拟

这次考的一般般:
分数and rank

T 1 T1 T1

水过了 ,暴力,不用讲。

T 2 T2 T2

用了贪心,贪了 20 20 20分,正解是不懂的树形DP

T 3 T3 T3

01 01 01字典树,我对01字典树的理解似乎有问题,我竟然用了 d f s dfs dfs实现:

void build(int o,int u){
    
    
	if(u>20) return ;
	if(tree[o][a[u]]==0){
    
    
		cnt++;
		tree[o][a[u]]=cnt;
	}
	build(tree[o][a[u]],u+1);
}
void find(int o,int u,int len){
    
    
	if(len>=ans)return ;//少一个剪枝让我少50分,难受
	if(u>20){
    
    
		ans=min(len,ans);
		return ;
	}
	if(tree[o][a[u]]!=0)
		find(tree[o][a[u]],u+1,len);
	if(tree[o][1-a[u]]!=0)
		find(tree[o][1-a[u]],u+1,len+1);
}

但我是2020中第一个不是用水法水过的人,还挺开心。

T 4 T4 T4

题都没读懂。

猜你喜欢

转载自blog.csdn.net/zhy_Learn/article/details/107861981