题目大意:
n波人去k*k的电影院看电影。
要尽量往中间坐,往前坐。
直接枚举,贪心,能坐就坐,坐在离中心最近的地方。
#include
#include
#include
#include
#define maxn 1000005
#define lowbit(x) (x&(-x))
using namespace std;
struct BI...
分类:
其他好文 时间:
2014-07-10 22:52:57
阅读次数:
262
Base Station
Time Limit: 20000/10000MS (Java/Others)Memory Limit: 512000/256000KB (Java/Others)
SubmitStatisticNext
Problem
Problem Description
移动通信系统中,通信网的建立主要通过基站来完成。
基站可以分为主基站和子...
分类:
其他好文 时间:
2014-07-08 21:23:16
阅读次数:
297
1990题意:每头牛有两个属性v,x,计算sigma(max(v[i],v[j])*abs(x[i]-x[j]))1=x[j] +sigma(v[j]*(x[j]-x[i])) x[i]=x[j]其中dist.sum(maxn)-dist.sum(x[i]) 就是坐标在[x[i],maxn]...
分类:
其他好文 时间:
2014-07-07 14:26:47
阅读次数:
292
题意:无限大的棋盘上,在横向和纵向上被包围的白子会变成黑子,求最终黑子个数?分析:首先这个棋盘十分的大,但已给黑点的个数为1e5,我们需要离散化,所谓的离散化就是数组下标的重新定义。这里给出离散化函数,返回的是离散化后数组的个数 1 int compress(int *p,int N) 2 { 3 ...
分类:
其他好文 时间:
2014-07-07 13:30:16
阅读次数:
309
树状数组树状数组(Binary Indexed Tree(BIT), Fenwick Tree)是一个查询和改动复杂度都为log(n)的数据结构。主要用于查询随意两位之间的全部元素之和,可是每次仅仅能改动一个元素的值;经过简单改动能够在log(n)的复杂度下进行范围改动,可是这时仅仅能查询当中一个元...
分类:
其他好文 时间:
2014-07-07 13:13:05
阅读次数:
166
DescriptionConsider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root nod...
分类:
其他好文 时间:
2014-07-06 13:23:06
阅读次数:
229
Description
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this ...
分类:
其他好文 时间:
2014-07-06 11:36:14
阅读次数:
284
【BZOJ2709】水的二分加验证。但是好像被读入萎到了。。。
【BZOJ3229】强大的算法见此。被机房的一堆大神“推荐”,于是被坑了。。。写了一个下午。。。
【BZOJ3631】这道题给我的启示是:要多想想算法。开始一直在打树链剖分,打到一半忽然在众神犇的提(bi)示(shi)下,发现有O(N)的方法。试想:如果要支持区间修改(加减),最后再查询,可以用什么方法?固然,线段树和树状数组等等...
分类:
其他好文 时间:
2014-07-04 00:28:36
阅读次数:
333
题目给了你一串序列,然后每次 把最后一个数提到最前面来,直到原来的第一个数到了最后一个,每次操作都会产生一个新的序列,这个序列具有一个逆序数的值,问最小的你逆序数的值为多少
逆序数么 最好想到的是树状数组,敲了一把很快,注意把握把最后一个数提上来对逆序数的影响即可,
#include
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-07-01 06:42:09
阅读次数:
186