博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[BJWC2010]外星联络
阅读量:4561 次
发布时间:2019-06-08

本文共 616 字,大约阅读时间需要 2 分钟。

暴力建trie

  

#include
#include
#include
const int maxn = 5000000;char ch[3000];int son[maxn][2],sz[maxn],tot=1,n;inline void ins(const char*ch){ int rt=1; for(;*ch;++ch){ int&x=son[rt][*ch-48]; if(!x)x=++tot; ++sz[rt=x]; }}inline void dfs(int rt){ if(sz[rt]>1)std::cout << sz[rt] << '\n'; if(son[rt][0])dfs(son[rt][0]); if(son[rt][1])dfs(son[rt][1]);}int main(){ std::ios::sync_with_stdio(false),std::cin.tie(0); std::cin >> n; std::cin >> ch; for(int i=0;i

 

转载于:https://www.cnblogs.com/skip1978/p/10348604.html

你可能感兴趣的文章
mysql数据库2-常用命令
查看>>
安卓开发环境搭建(转)
查看>>
英语学习一周年
查看>>
set容器
查看>>
python基础学习目录
查看>>
卷积神经网络是如何工作的(译文)
查看>>
微信开发 笔记1
查看>>
SQL server 删除日志文件 秒删
查看>>
MethodChannel 实现flutter 与 原生通信
查看>>
lua的性能优化
查看>>
vs2012 出现断点无法命中 解决方案。
查看>>
weex图片加载更多方法loadmore的使用
查看>>
创建您的 ActiveReports Web端在线报表设计器
查看>>
项目复审
查看>>
FreeMarker学习
查看>>
hihocoder 1631
查看>>
2018大都会赛 A Fruit Ninja【随机数】
查看>>
【实战HTML5与CSS3】用HTML5和CSS3制作页面(上)
查看>>
小公司的一年,一起看看小公司的前端可以怎么做
查看>>
oracle数据批处理
查看>>