BZOJ2527: [Poi2011]Meteors】的更多相关文章

补一发题解.. 整体二分这个东西,一开始感觉复杂度不是很靠谱的样子 问了po姐姐,说套主定理硬干.. #include<bits/stdc++.h> #define ll long long #define inf 1e9 #define N 300005 using namespace std; inline int read(){ ,f=;char ch=getchar(); ;ch=getchar();} *x+ch-';ch=getchar();} return x*f; } int…
原文链接http://www.cnblogs.com/zhouzhendong/p/8686460.html 题目传送门 - BZOJ2527 题意 有$n$个国家. 太空里有$m$个太空站排成一个圆圈.其中第$i$的太空站是第$O_i$个国家的. 第$i$个国家要通过自己的太空站收集$P_i$数量的陨石雨. 现在有$k$场陨石雨,第$i$场陨石雨会给$L_i~R_i$(顺时针数)的所有太空站分别带来$A_i$数量的陨石雨. 再解释下这个$L_i~R_i$,如果$L_i<=R_i$,那么代表的区…
题目描述 Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange meteor showers, which on the other hand make it an exceptionally interesting object of study. Th…
http://www.lydsy.com/JudgeOnline/problem.php?id=2527 整体二分 区间加,单点查,树状数组维护差分序列 注意 累积可能会爆long long,所以一满足要求就break #include<cstdio> #include<iostream> #include<algorithm> using namespace std; #define N 300001 #define lowbit(x) x&-x typede…
对于单个国家,可以对答案进行二分,每次找出此时的陨石数量,如果大于需要的那么答案就在[l,mid],否则就在[mid+1,r]里面 而对于很多国家,也可以进行二分,solve(l,r,L,R)表示询问id[l...r]的答案都在[L,R]之间 每次用树状数组统计一下 Code #include <cstdio> #include <algorithm> #define lowbit(x) ((x)&(-x)) #define N 300010 #define ll long…
题目 Byteotian Interstellar Union有N个成员国.现在它发现了一颗新的星球,这颗星球的轨道被分为M份(第M份和第1份相邻),第i份上有第Ai个国家的太空站. 这个星球经常会下陨石雨.BIU已经预测了接下来K场陨石雨的情况. BIU的第i个成员国希望能够收集Pi单位的陨石样本.你的任务是判断对于每个国家,它需要在第几次陨石雨之后,才能收集足够的陨石. 输入格式 第一行是两个数N,M. 第二行有M个数,第i个数Oi表示第i段轨道上有第Oi个国家的太空站. 第三行有N个数,第…
Description Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange meteor showers, which on the other hand make it an exceptionally interesting object of st…
[BZOJ2527][Poi2011]Meteors Description Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange meteor showers, which on the other hand make it an exceptional…
[bzoj2527][Poi2011]Meteors Description Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange meteor showers, which on the other hand make it an exceptional…
Meteors bzoj-2527 Poi-2011 题目大意:题目链接. 注释:略. 想法: 首先答案可以离线,且具有单调性. 这里的单调性就是随着时间的推移,每个国家收集的陨石数增加. 不难想到整体二分,对时间进行二分. 但是有一个问题,就是一个国家出现了多次,这样的话我们用链表把他们记录到一起即可,二分的时候传链头. 这个题就是用树状数组+差分实现区间加. 先把$[l,mid]$的操作都用树状数组加上.然后枚举当前还没有答案的国家:每一个都访问整条链加一起跟自己需要的$k$判断一下扔进左区…