摘要: #include #include #include #include #include #include using namespace std; int n,m,INF=99999999; int e[1001][1001],road[1001],jdg[1001]; int main() { cin>>n>>m; for(int i=1;i>a>>b>>c; ... 阅读全文
posted @ 2018-07-08 17:30 radishえらい 阅读(90) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include using namespace std; int n,m,s,t,cnt,head[100001]; int dis[100001],vis[100001]; struct uio{ int to,nxt,wei; }edge[10000001]... 阅读全文
posted @ 2018-07-08 17:30 radishえらい 阅读(101) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; int m,n,ans,a[501],b[501],dp[501][501],pre[501][501],lcis[501]; int main() { scanf("%d",&n); for(int i=1;ib[j]&&dp[i... 阅读全文
posted @ 2018-07-08 17:29 radishえらい 阅读(145) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; int n,m,jdg[5001],cnt,ans; struct uio{ int from,to,que; }road[200001]; int find(int x) { if(x==jdg[x]) retur... 阅读全文
posted @ 2018-07-08 17:28 radishえらい 阅读(110) 评论(0) 推荐(0) 编辑
摘要: //dinic 最大流 //head[x]从0开始记 这样便于找反向边 异或即可 //当前弧优化 #include #include #include #include #include #include #include #define ll long long #define ull unsigned long long #define INF 0x3f3f3f3f using nam... 阅读全文
posted @ 2018-07-08 17:27 radishえらい 阅读(114) 评论(0) 推荐(0) 编辑
摘要: //EK 最小费用最大流 //只需将最大流中的bfs改为SPFA即可 //注意 若要跑最大费用最大流 只需在加边时将正反边费用分别取反 //跑完最小费用最大流后把mincost取反即可 #include #include #include #include #include #include #include #define ll long long #define ull unsigned... 阅读全文
posted @ 2018-07-08 17:27 radishえらい 阅读(142) 评论(0) 推荐(0) 编辑
摘要: //双重Hash 可保证不重复 //空间较大 时间较慢 不易被卡 #include #include #include #include #include #include #define MOD1 233333339 #define MOD2 233333393 #define MOD3 233333939 #define base 233 #define ull unsigned long... 阅读全文
posted @ 2018-07-08 17:25 radishえらい 阅读(144) 评论(0) 推荐(0) 编辑
摘要: //树状数组 //支持给某位置增加常数与查询前缀和 #include #include #include #include #include #include using namespace std; int n,a[1001],tree[1001];//tree树状数组 int lowbit(int x)//表示2^k k是二进制数x的末尾0个数 { return x&(-x); ... 阅读全文
posted @ 2018-07-08 17:25 radishえらい 阅读(92) 评论(0) 推荐(0) 编辑
摘要: //树链剖分 //将最短路上的区间分成若干条链 使得每一条链上的操作都能用线段树解决 //分轻重 重儿子为某节点的儿子中儿子最多的子节点 重儿子之间的边为重边 重边相连即为重链 #include #include #include #include #include #include using namespace std; int n,m,root,MOD,dot[100001],dot... 阅读全文
posted @ 2018-07-08 17:25 radishえらい 阅读(102) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #define ll long long using namespace std; ll n,jdg[1000001],prime[1000001],phi[1000001],cnt,ans; int main() { scanf("%lld",&n); phi[1]=1;... 阅读全文
posted @ 2018-07-08 17:24 radishえらい 阅读(91) 评论(0) 推荐(0) 编辑