摘要: #include#include#include#includeusing namespace std;#define maxn 1604#define maxm 60002#define inf 0x3fffffff#define s(a) ((ab)swap(a,b);add(t(a),s(b),z,1);add(s(b),t(a),-z,0);}do do ff++;while(zeng(S,inf));while(modlab());cout<<cost;} 阅读全文
posted @ 2014-04-01 16:55 wangyucheng 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 神贪心。。。b[i]=a[1]-(n-1)*d;每次找价值最大的k使b[k]~b[n]都++#include#include#include#includeusing namespace std;#define maxn 6000 #define ll long longinline long long min(long long x, long long y) {return xy?x:y;}; inline long long ABS(long long x) {return x=2;j--){if(b[j]>=a[j])now--;else now++,up=min(up,a[j] 阅读全文
posted @ 2014-03-31 21:17 wangyucheng 阅读(349) 评论(0) 推荐(0) 编辑
摘要: D. Hill Climbingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis problem has nothing to do with Little Chris. It is about hill climbers instead (and Chris definitely isn't one).There arenhills arranged on a line, each in the form of a vert 阅读全文
posted @ 2014-03-31 16:36 wangyucheng 阅读(336) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#includeusing namespace std;#define ll long long#define maxn 100000int n;ll l;ll c[maxn];ll X[maxn],Y[maxn];ll f[maxn];int bo,he,qu[maxn];int main(){ scanf("%d%lld",&n,&l); for(int i=1;ibo&&(Y[qu[bo+1]]-Y[qu[bo]])bo&&(double)(Y[qu[he] 阅读全文
posted @ 2014-03-26 21:08 wangyucheng 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 预处理的d[i][j]为第i块到第j点的答案块外的暴力#include#include#include#include#include#includeusing namespace std;#define maxn 100100#define maxs 320int S,T;int n,m,c;vector col[maxn];int a[maxn];int le[maxs],ri[maxs];int d[maxs][maxn];int rec,cas;int op[maxs],cc[maxn];int lab[maxn],num;int ask(int x,int y){ int mi... 阅读全文
posted @ 2014-03-26 19:38 wangyucheng 阅读(245) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#includeusing namespace std;#define maxn 1000100int l[maxn],r[maxn],nn,e[maxn],v[maxn],ne[maxn],op1[maxn],op2[maxn],n,m,c,nex[maxn],now[maxn];int ans[maxn];void add(int x,int y){ ne[++nn]=e[x],e[x]=nn,v[nn]=y;}int a[maxn],cl[maxn];int lowbit(int x){ return x&-x; } 阅读全文
posted @ 2014-03-25 19:52 wangyucheng 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;#define maxn 1000100#define ll long long#define dd doubleint n;ll x[maxn],p[maxn],c[maxn];ll X[maxn],P[maxn],C[maxn],A[maxn];ll f[maxn],yy[maxn];int qu[maxn],he,bo;ll a1[maxn],a2[maxn],a3[maxn];int main(){ scanf("%d",&n); for(int i=1; 阅读全文
posted @ 2014-03-25 17:22 wangyucheng 阅读(149) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#define maxn 102000#define maxm 400100using namespace std;int e[maxn],ne[maxm],v[maxm];int nn;int val[maxn];int dp[maxn][2];int pre[maxn];void add(int x,int y){ ne[++nn]=e[x],e[x]=nn,v[nn]=y; }int n,m;int low[maxn],dfn[maxn],tot;void tarjan(int x){ low[x]=d... 阅读全文
posted @ 2014-03-24 21:23 wangyucheng 阅读(597) 评论(0) 推荐(0) 编辑
摘要: 平面图转对偶图暴力枚举保护那些点然后求最小割即可#include#include#include#include#includeusing namespace std;#define maxn 4000#define maxp 12#define ll long long#define inf 0x3fffffffstruct P{ int a,b; }a1[maxn],p1[12];int n,m,p;int nn=1;int e[maxn],ne[maxn],v[maxn],w[maxn];int ver[maxn],he[maxn],nex[maxn],u[maxn];void add. 阅读全文
posted @ 2014-03-21 21:49 wangyucheng 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 这题我开了三个链表第一个是临界表第二个是缩点后的临界表第三个是hash表判重边#include#include#include#include#includeusing namespace std;#define ll long long#define maxm 1001020#define maxn 110000int nn,nn1,nn2,n,m,mod;int e[maxn],ne[maxm],v[maxm];int e1[maxn],ne1[maxm],v1[maxm];int e2[maxm],ne2[maxm],v2[maxm],u2[maxm];void add(int x,in 阅读全文
posted @ 2014-03-19 21:35 wangyucheng 阅读(320) 评论(0) 推荐(0) 编辑