bieset学习、
来源:互联网 发布:react 源码 component 编辑:程序博客网 时间:2024/06/11 19:33
参考:blackcat
bitset 优化floyd
#include <cstdio>#include <cstring>#include <cmath>#include <cstdlib>#include <ctime>#include <iostream>#include <algorithm>#include <sstream>#include <string>#include <vector>#include <queue>#include <stack>#include <map>#include <set>#include <utility>#include <bitset>using namespace std;#define LL long long#define pb push_back#define mk make_pair#define pill pair<int, int>#define mst(a, b)memset(a, b, sizeof a)#define REP(i, x, n)for(int i = x; i <= n; ++i)const int MOD = 1e9 + 7;const int qq = 1e3 + 10;const int INF = 1e9 + 10;int n, m;bitset<qq> mp[qq];void Floyd() {for(int i = 1; i <= n; ++i) {for(int j = 1; j <= n; ++j) {if(mp[j][i])mp[j] |= mp[i];}}}int main(){scanf("%d%d", &n, &m);for(int a, b, i = 1; i <= m; ++i) {scanf("%d%d", &a, &b);mp[a][b] = 1;}Floyd();int ans = 0;for(int i = 1; i <= n; ++i) {for(int j = i + 1; j <= n; ++j) {if(!mp[i][j] && !mp[j][i])ans++;}}printf("%d\n", ans);return 0;}
阅读全文
0 0
- bieset学习、
- 操作系统大型实验进展(13)-----bieset
- hdu5890(二维01背包+bieset优化)
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 学习
- 文字漂浮的小功能 lua代码框架下实现
- TensorFlow安装(windows)
- C源文件到ELF可执行文件的生成过程
- 用js、css 弹出窗口
- hdu6195(规律)
- bieset学习、
- 认识RUP,XP,敏捷过程
- static_cast、dynamic_cast、const_cast和reinterpret_cast
- activemq 操作界面讲解
- jQuery操作input值总结
- 跟着《Learn Python The Hard Way》学Python(一)
- 如何进行数据的归一化问题
- bzoj 1689: [Usaco2005 Open] Muddy roads 泥泞的路(模拟)
- web.config中配置数据库连接的两种方式