2012年10月17日

Mayor's posters poj 2528

摘要: View Code 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 const int maxn=100005; 7 bool Hash[maxn]; 8 int li[maxn],ri[maxn]; 9 int num[maxn*3],spt[maxn<<4];10 int cnt;11 int GotNum(int key,int n){12 int l=0,r=n- 阅读全文

posted @ 2012-10-17 23:36 Acmer_Roney 阅读(157) 评论(0) 推荐(0) 编辑

Count Color poj 2777

摘要: 题意:一个板,分成L段,开始板的每一段都被涂成颜色1。接下来对板有两种操作:1. "C A B C" Color the board from segment A to segment B with color C.2. "P A B" Output the number of different colors painted between segment A and segment B (including). 题解:线段树+lazy.思路:线段树的每个节点记录该段的颜色编号。叶节点记录该段的颜色,父亲节点记录该段的颜色。所以一开始建树时,所有节点的 阅读全文

posted @ 2012-10-17 13:02 Acmer_Roney 阅读(181) 评论(0) 推荐(0) 编辑

导航