题意:一长由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
A Corrupt Mayor's Performance Art
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 100000/100000
K (Java/Others)
...
分类:
其他好文 时间:
2014-09-21 12:12:30
阅读次数:
183
把求和操作改为或操作,就可以了。 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
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
更新区间内颜色
输出区间内的颜色总数
#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
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 20:23:09
阅读次数:
289
题目: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