摘要:
#include#include#include#includeusing namespace std;typedef long long ll;#define N 50010#define inf 0x6fffffffffLLstruct P{ int x,y; ll w,org; ... 阅读全文
摘要:
#include#include#include#includeusing namespace std;#define N 10#define M (1>((k-1)*2))&3); } cout>m*2){ cont... 阅读全文
摘要:
#include#include#include#include#define mod 999983#define maxn 302#define F(x,y) for(int x=1;x>n; F(i,n)F(j,n)scanf("%lld",&a[i][j]); F(i,n)F(j,... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define maxn 60500 8 #define inf 0x3fffffff 9 int ch[maxn][2]; 10 int s[maxn],ma[maxn],val[maxn],pre[maxn],rt[maxn]; 11 int n,nn; 12 int e[maxn],ne[maxn*2],f[maxn],v[maxn*2]; 13 void add(int x,int y){ 14 ne... 阅读全文
摘要:
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2561#include#include#include#include#includeusing namespace std;#define maxn 20010#define maxm 400100int e[maxn],u[maxm],ne[maxm],v[maxm],l[maxm],n,m,tt=1;int s,t,L;bool been[maxn];void add(int x,int y,int z){ ne[++tt]=e[x],e[x]=tt,v[tt]=y,l[... 阅读全文
摘要:
求最大流,在残余网络上跑tarjan求出所有SCC,记id[u]为点u所在SCC的编号。显然有id[s]!=id[t](否则s到t有通路,能继续增广)。①对于任意一条满流边(u,v),(u,v)能够出现在某个最小割集中,当且仅当id[u]!=id[v];②对于任意一条满流边(u,v),(u,v)必定出现在最小割集中,当且仅当id[u]==id[s]且id[v]==id[t]。#include#include#include#include#includeusing namespace std;#define maxn 4200#define maxm 130000#define inf 0x3 阅读全文
摘要:
/************************************************************** Problem: 1449 User: wangyucheng Language: C++ Result: Accepted Time:268 ms Memory:2532 kb****************************************************************/ #include#include#include#include#includeusing namespace std;#de... 阅读全文
摘要:
/************************************************************** Problem: 2300 User: wangyucheng Language: C++ Result: Accepted Time:564 ms Memory:7292 kb****************************************************************/ #include#include#include#include#include#includeusing namespace... 阅读全文
摘要:
#include#include#include#include#includeusing namespace std;#define maxn 60000typedef long long ll;ll gcd(ll x,ll y){ if(x>y)return gcd(y,x); return x==0?y:gcd(y%x,x);}ll S;struct P{ ll l,r,c; bool operatoraa[i-1].r)for(int j=aa[i-1].r+1;jaa[i-1].l)for(int j=aa[i-1].l;j<aa[i].l;j++)dele(j); i. 阅读全文
摘要:
在并查集的同时维护到第一个点的距离#include#include#include#include#includeusing namespace std;#define maxn 200int f[maxn];int t[maxn];int get(int x){ if(f[x]==x)return x; int l=get(f[x]); t[x]+=t[f[x]]; return f[x]=l;}int n,m;int w;int main(){ scanf("%d",&w); while(w--){ bool p=0; scanf("%d%d" 阅读全文