当前位置: 首页 > news >正文

建站优化办事效率高日本域名注册

建站优化办事效率高,日本域名注册,外国设计网站推荐,长城宽带Problem - 514C - Codeforces 题意: 思路: 其实是trie上dfs的板题 先把字符串插入到字典树中 对于每次询问,都去字典树上dfs 注意到字符集只有3,因此如果发现有不同的字符,去枚举新的字符 Code: #in…

Problem - 514C - Codeforces

题意:

 

思路:

其实是trie上dfs的板题

先把字符串插入到字典树中

对于每次询问,都去字典树上dfs

注意到字符集只有3,因此如果发现有不同的字符,去枚举新的字符

Code:

#include <bits/stdc++.h>using i64 = long long;using namespace std;const int N = 4e5 + 10;
const int M = 3e6 + 10;
const int P = 131;string s;int tot = 0;
int tag[N];
int tr[N][30];void insert(string x) {int p = 0;for (int i = 0; i < x.size(); i ++) {int u = x[i] - 'a';if (! tr[p][u]) {tr[p][u] = ++tot;}p = tr[p][u];}tag[p] = 1;
}
bool dfs(int dep, int u, int num) {if (s[dep]) {int v = s[dep] - 'a';if (tr[u][v]) {if (dfs(dep + 1, tr[u][v], num)) return true;}if (!num) {for (int j = 0; j < 3; j ++) {if (j != v && tr[u][j]) {if (dfs(dep + 1, tr[u][j], num + 1)) return true;}}}}else if (tag[u] && num) return true;return false;
}
void solve() {int n,m;cin >> n >> m;for (int i = 1; i <= n; i ++) {cin >> s;insert(s);}for (int i = 1; i <= m; i ++) {cin >> s;if (dfs(0, 0, 0)) {cout << "YES" << "\n";}else {cout << "NO" << "\n";}}
}
signed main(){ios::sync_with_stdio(false);cin.tie(nullptr);int t = 1;//cin >> t;while(t --) {solve();}return 0;
}

http://www.tj-hxxt.cn/news/46899.html

相关文章:

  • 2万元最简单装修小红书关键词排名优化
  • 建设股票交易网站百度智能小程序怎么优化排名
  • 网站与网站做外链好吗百度网络科技有限公司
  • 提高网站互动性免费com网站域名注册
  • 做cms网站步骤谷歌广告
  • 怎么找网站帮我做推广网站seo教材
  • 做采集网站赚钱吗软文推广案例
  • 博客可以放自己做的网站网络营销流程
  • win7系统做网站服务器seo运营工作内容
  • 知识库管理系统方案seo推广官网
  • 一个网站做两个优化可以做吗广州新塘网站seo优化
  • 广告推广计划合肥网站优化搜索
  • 郑州专业网站设计公司地址产品推广策划书
  • acm网站免费做百度服务中心投诉
  • 泉州网站建设价格公司网站建设哪个好
  • 相亲网与做网站长春网站seo
  • asp网站开发视频教程h5下一页
  • 去年做的电子请帖怎么找原网站北京关键词排名推广
  • 网站做某个关键词排名该怎么做上海网络推广联盟
  • 网站制作.公司的seo是什么意思
  • 专门网站建设湖南正规seo优化
  • 做效果图挣钱的网站广州权威发布
  • 做网站的前端技术正规的网店培训机构有哪些
  • 个人直播网站开发培训机构加盟店排行榜
  • 帮人做网站推选的公司外链seo招聘
  • 做一个网站的全部流程长春网络科技公司排名
  • 邯郸个人做网站拓客公司联系方式
  • 福州seo网站推广网站的建设流程
  • 宣传网站建设方案模板企业网站cms
  • 做网上水果网站的调查seo搜索培训