摘要:
二分 + 双端队列广搜 复杂度 $m \cdot log(r - l) = 1 \times 10^4 \times log(10^9) = 3 \times 10^5$ 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long 阅读全文
摘要:
最短路 + DFS 枚举顺序 最短路用堆优化 dijkstra 复杂度 $O(m \cdot log(n)) = 10^5 \cdot log(5 \times 10^4) \approx 1.56 \times 10^6$ DFS 枚举复杂度 $O(n!) = 5! = 120$ 两个复杂度是相加 阅读全文
摘要:
递推 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 100 + 10; int n, m; int a[N][N], g[N][N]; int dx[] = {0, -1 阅读全文
摘要:
三维迷宫 BFS + 结构体存储 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 100 + 10; const int INF = 0x3f3f3f3f; int L, 阅读全文
摘要:
八皇后问题的变形 $DFS$ 按行枚举 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 10 + 10; int n, m; char g[N][N]; bool col[ 阅读全文