上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 26 下一页
摘要: 点击查看代码 #include<iostream> #include<cstring> #include<queue> using namespace std; const int N = 1e5 + 10; int n, m; int h[N], e[N], ne[N], idx; int d[N 阅读全文
posted @ 2022-05-05 23:37 wKingYu 阅读(47) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 1e5 + 10, M = 2 * N; int n, ans = N; int h[N], e[M], ne[M], idx; bool s 阅读全文
posted @ 2022-05-05 22:57 wKingYu 阅读(57) 评论(0) 推荐(1)
摘要: 点击查看代码 #include<iostream> #include<queue> #include<unordered_map> using namespace std; int bfs(string start) { string end = "12345678x"; queue<string> 阅读全文
posted @ 2022-05-05 15:06 wKingYu 阅读(42) 评论(0) 推荐(1)
摘要: BFS 使用STL中的queue 点击查看代码 #include<iostream> #include<cstring> #include<queue> using namespace std; typedef pair<int, int> PII; const int N = 100 + 10; 阅读全文
posted @ 2022-05-05 00:19 wKingYu 阅读(72) 评论(0) 推荐(1)
摘要: DFS 按行枚举 时间复杂度 \(O(n!)\) 点击查看代码 #include<iostream> using namespace std; const int N = 20; int n; char g[N][N]; bool col[N], dg[N], udg[N]; void dfs(in 阅读全文
posted @ 2022-05-04 23:04 wKingYu 阅读(50) 评论(0) 推荐(1)
摘要: 点击查看代码 #include<iostream> using namespace std; const int N = 10; int n, path[N]; bool st[N]; void dfs(int u) { if (u > n) { for (int i = 1; i <= n; i 阅读全文
posted @ 2022-05-04 21:24 wKingYu 阅读(37) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> using namespace std; typedef unsigned long long ULL; const int N = 1e5 + 10; const int P = 131; int h[N], p[N]; char str[N]; 阅读全文
posted @ 2022-05-03 22:16 wKingYu 阅读(88) 评论(0) 推荐(0)
摘要: 拉链法 点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 1e5 + 3; int h[N], e[N], ne[N], idx; void insert(int x) { int k = ( 阅读全文
posted @ 2022-05-03 19:35 wKingYu 阅读(50) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int h[N], sz, m; int ph[N], hp[N]; void heap_swap(int a, int b) { swap(ph[hp[a] 阅读全文
posted @ 2022-05-03 17:44 wKingYu 阅读(55) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> using namespace std; const int N = 1e5 + 10; int h[N], sz; void down(int u) { int t = u; if (2 * u <= sz && h[2 * u] < h[t]) 阅读全文
posted @ 2022-05-03 15:50 wKingYu 阅读(24) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 26 下一页