摘要: #include using namespace std; int tot,dui[10000000],n,x,y; inline void add(int i) { tot++; dui[tot] = i; int k = tot; while(k>1 && dui[k] >1]) { swap(dui[k] , dui[k>>1]);... 阅读全文
posted @ 2017-10-13 16:12 cc123321 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 小陈现有2个任务A,B要完成,每个任务分别有若干步骤如下:A=a1->a2->a3,B=b1->b2->b3->b4->b5.在任何时候,小陈只能专心做某个任务的一个步骤.但是如果愿意,他可以在做完手中任务的当前步骤后,切换至另一个任务,从上次此任务第一个未做的步骤继续.每个任务的步骤顺序不能打乱, 阅读全文
posted @ 2017-10-12 11:10 cc123321 阅读(1978) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #define maxn 5050 #define fi first #define se second using namespace std; typedef pair PII; vector s[maxn]; int map[5001][5001]; int low_cost[maxn],zou[maxn],n,m,... 阅读全文
posted @ 2017-10-12 10:42 cc123321 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 区间 题目描述: 样例输入: 样例输出: 提示: 【数据规模】对于20% 的数据, N<=20。对于40% 的数据, N<=100。对于60% 的数据, N<=2000。对于80% 的数据, N<=80000。对于100% 的数据, N<=300000。 为了强行增加难度,这道题似乎是卡常数的? 时 阅读全文
posted @ 2017-10-09 20:36 cc123321 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 一眼看去,完全看不出来这TM是背包。知道用背包可以借之后却还是一脸蒙蔽,后来经过LZ学长的点拨,终于顿悟了!!! 我们设f[i] 表示用取i个(也可以没有i个)数所可以得到的最大值,那么有方程式:f[i] = max(f[i] , f[v] + d[j]) v = i - l[j]; wokao!! 阅读全文
posted @ 2017-10-06 20:05 cc123321 阅读(225) 评论(0) 推荐(0) 编辑
摘要: #include #include #define maxn 510 using namespace std; int k,g,b,x,y,ans,girl[maxn],zou[maxn],s[maxn][maxn]; int find(int x) { for(int i=1;i<=b;i++) { if(s[x][i] && !zou[i]) ... 阅读全文
posted @ 2017-09-14 17:04 cc123321 阅读(163) 评论(0) 推荐(0) 编辑
摘要: #include #include #define maxn 100000 #define lb(x) x&-x using namespace std; int f[maxn],n,m,k,tot; struct st{ int a,b; }s[maxn]; void update(int x,int val) { while(x>n; for(int i=1;i>s[... 阅读全文
posted @ 2017-09-09 11:18 cc123321 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 在网上一直看到用二分做的借教室,说什么线段树会惨遭TLE,然后我就试了一下,并没有什么事情发生(或许是因为optimizi(2)...),但并没有什么关系!!! 我们只需要在每个树的节点上打上mi的标记,表示其子树的最小值,在更新的时候如果mi小于0,就知道不行了,标记一下直接输出就好了。。。 详见 阅读全文
posted @ 2017-08-19 21:41 cc123321 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 如何将普通树状数组升级 普通的单点修改单点查询就不讲了,从区间修改和单点查询讲起。 原来的值存在a[]里面,多建立个数组c1[],注意:c1[i]=a[i]-a[i-1]。 那么求a[i]的值的时候a[i]=a[i-1]+c1[i]=a[i-2]+c1[i]+c1[i-1]=…..=c1[1]+c1 阅读全文
posted @ 2017-08-19 21:31 cc123321 阅读(3084) 评论(2) 推荐(2) 编辑
摘要: 初看此题之时,只感觉麻烦至极,要从一个个关系中又推出其他关系,烦死人啊!!!然后在网上找到了一种神奇的用了HAXU的解法,超级妙啊!!! 用f[x]表示了0到x的奇偶,然后设f[x+mod]=f[x]^1。这样就很好判断啊!!!太6了。。。 阅读全文
posted @ 2017-08-18 11:18 cc123321 阅读(221) 评论(0) 推荐(0) 编辑