Link:  http://acm.hdu.edu.cn/showproblem.php?pid=5023 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #include <string> #include <cmath> using namespace std; typedef…
A Corrupt Mayor's Performance Art Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 100000/100000 K (Java/Others)Total Submission(s): 33    Accepted Submission(s): 11 Problem Description Corrupt governors always find ways to get dirty money. Pa…
A Corrupt Mayor's Performance Art Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 100000/100000 K (Java/Others) Problem Description Corrupt governors always find ways to get dirty money. Paint something, then sell the worthless painting at a…
http://acm.hdu.edu.cn/showproblem.php?pid=5023 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 seem…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5023 解题报告:一面墙长度为n,有N个单元,每个单元编号从1到n,墙的初始的颜色是2,一共有30种颜色,有两种操作: P a b c  把区间a到b涂成c颜色 Q a b 查询区间a到b的颜色 线段树区间更新,每个节点保存的信息有,存储颜色的c,30种颜色可以压缩到一个int型里面存储,然后还有一个tot,表示这个区间一共有多少种颜色. 对于P操作,依次往下寻找,找要更新的区间,找到要更新的区间之前…
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 seemed a safe way for mayor X to make money. Becaus…
题意:给定一个1-n的墙,然后有两种操作,一种是P l ,r, a 把l-r的墙都染成a这种颜色,另一种是 Q l, r 表示,输出 l-r 区间内的颜色. 析:应该是一个线段树+状态压缩,但是我用set暴力过去了.用线段树+状态压缩,区间更新,很简单,就不说了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #i…
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #define N 1000005 using namespace std; ]; ];//正值表示该节点所管理的区间的颜色是纯色,-1表示的是非纯色 int n, m; void buildT(int ld, int rd, int p){ if(ld <= rd){ tree[p] = ;//初始每一个…
题目原文废话太多太多太多,我就不copyandpaste到这里啦..发个链接吧题目 题目意思就是:P  l  r  c  将区间 [l ,r]上的颜色变成c    Q  l r 就是打印出区间[l,r]中所有的颜色,并且要升序排列出来,注意最坑的就是各个区间的颜色初始化为2,这个条件竟然夹杂在那又长又臭的题目的某个角落里面!! 比赛的时候思路是有的,并且也能想到用set来撸,哎,对set的用法太挫逼了,写线段树又写得太挫逼了,后来补回这道题的时候,才发现其实是一道非常常规的线段树,所以最近给自己…
题目链接: 传送门 Mayor's posters Time Limit: 1000MS     Memory Limit: 65536K Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim…