题意:一长由N小段组成的长条,每小段的初始颜色为2。现执行M个操作,每个操作是以下两种中的一种(0
P a b c ——> 将段a到段b涂成颜色c,c是1, 2, ... 30中的一种(0
Q a b ——> 问段a到段b之间有哪几种颜色,按颜色大小从小到大输出(0
——>>很明显此题可以用线段树实现Mlog(N)的解法。。(看完输入就敲题了,把初始颜色设为了无,耗了好多时间:看题要仔...
分类:
其他好文 时间:
2014-09-21 12:26:00
阅读次数:
214
把求和操作改为或操作,就可以了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define lson l,m,rt>1;27 build(lson);28 build(rson);29 up(r...
分类:
其他好文 时间:
2014-09-21 11:27:10
阅读次数:
228
1 #include 2 #include 3 #include 4 #include 5 #define N 1000005 6 using namespace std; 7 8 int c[35]; 9 int tree[N*4];//正值表示该节点所管理的区间的颜色是纯色,-1表示的是非纯.....
分类:
其他好文 时间:
2014-09-21 05:19:00
阅读次数:
235
A Corrupt Mayor's Performance Art
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 100000/100000 K (Java/Others)
Total Submission(s): 255 Accepted Submission(s): 114
Problem Descrip...
分类:
其他好文 时间:
2014-09-20 23:40:19
阅读次数:
278
BFC的理解与应用首先我们来看看w3c规范对BFC的解释,其实对于这种概念的学习上,我们总是建议首先寻找官方的定义,因为原则上来说官方的才是最权威和正确的,而且还比较详细,千万不要因为看到英文就畏惧不前。什么是BFC(Block formatting contexts)w3c规范中的BFC定义:浮动...
分类:
其他好文 时间:
2014-09-20 23:30:29
阅读次数:
466
HDU 5023 A Corrupt Mayor's Performance Art(线段树+优美的位运算)...
分类:
其他好文 时间:
2014-09-20 23:12:59
阅读次数:
310
Problem Description
Corrupt governors always find ways to get dirty money. Paint something, then sell the worthless painting at a high price to someone who wants to bribe him/her on an auction, this ...
分类:
其他好文 时间:
2014-09-20 22:56:29
阅读次数:
258
属性传值:
属性传值适用于从前往后传值.
代理传值:适用于从后往前传值.
单例传值:
适合于从前往后传,从后往前传都可以,
但是内存空间不会被释放直到应用程序结束
NSUserDefaults:数据持久化的一种方式,数据可以长久的存储,存到本地然后再从本地获取.通知:通知的使用需要注册通知,以及发送通知.
block: 需要定义
block,当
block 进行回调时将值传给其他...
分类:
其他好文 时间:
2014-09-20 22:36:49
阅读次数:
187
更新区间内颜色
输出区间内的颜色总数
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#include
#include
#include
#include
#include
#include
#define cler(arr...
分类:
其他好文 时间:
2014-09-20 21:24:49
阅读次数:
259
题目:1002 A Corrupt Mayor's Performance Art
题意:有一个长度 n 的序列,初始染色2,有两种操作,P x ,y ,z,区间x---y染色为z,另一种Q x,y,查询区间 x -- y 有几种颜色,并输出,注意会覆盖。
分析:跟POJ 2777一样,不过这个要输出颜色,所以线段树查询的时候顺便把路径存起来打印。代码:
AC代码:
#...
分类:
其他好文 时间:
2014-09-20 20:07:29
阅读次数:
333