摘要: 试除法 复杂度 \(O(\sqrt{n})\) 总体复杂度 $100 \times \sqrt{2^{31}} \approx 4.6 \times 10^{6} $ 点击查看代码 #include<iostream> using namespace std; bool is_prime(int n 阅读全文
posted @ 2022-05-07 23:48 wKingYu 阅读(40) 评论(0) 推荐(1)
摘要: 点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 510, M = 1e5 + 10; int n1, n2, m; int h[N], e[M], ne[M], idx; bool st[N 阅读全文
posted @ 2022-05-07 23:25 wKingYu 阅读(32) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 1e5 + 10, M = 2 * N; int n, m; int h[N], e[M], ne[M], idx; int color[N] 阅读全文
posted @ 2022-05-07 21:37 wKingYu 阅读(29) 评论(0) 推荐(0)
摘要: 复杂度 \(O(m*log(m))\) 点击查看代码 #include<iostream> #include<algorithm> using namespace std; const int N = 1e5 + 10, M = 2 * N, INF = 0x3f3f3f3f; int n, m; 阅读全文
posted @ 2022-05-07 15:23 wKingYu 阅读(43) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 510, INF = 0x3f3f3f3f; int n, m; int g[N][N]; int dist[N]; bool st[N]; 阅读全文
posted @ 2022-05-07 14:35 wKingYu 阅读(50) 评论(0) 推荐(0)
摘要: 复杂度 \(O(n^{3})\) 点击查看代码 #include<iostream> using namespace std; const int N = 210, INF = 1e9; int n, m, k; int d[N][N]; void floyd() { for (int k = 1; 阅读全文
posted @ 2022-05-07 13:13 wKingYu 阅读(45) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> #include<cstring> #include<queue> using namespace std; const int N = 1e5 + 10; int n, m; int h[N], e[N], ne[N], w[N], idx; i 阅读全文
posted @ 2022-05-07 11:07 wKingYu 阅读(34) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> #include<cstring> #include<queue> using namespace std; const int N = 1e5 + 10; int n, m; int h[N], e[N], ne[N], w[N], idx; i 阅读全文
posted @ 2022-05-07 10:28 wKingYu 阅读(51) 评论(0) 推荐(0)