随笔分类 - ACM---线段树/树状数组
摘要:No Pain No GameTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1465Accepted Submission(s): 631Prob...
阅读全文
摘要:Calculate the FunctionTime Limit: 2 Seconds Memory Limit: 65536 KBYou are given a list of numbers A1 A2 .. AN and M queries. For the i-th query:The query has two parameters Li and Ri.The query will define a function Fi(x) on the domain [Li, Ri] ∈ Z.Fi(Li) = ALiFi(Li + 1) = A(Li + 1)for all x >= L
阅读全文
摘要:AnotherLCISTimeLimit:1000msMemoryLimit:65536kBSolved:193Tried:2428DescriptionForasequenceS1,S2,...,SN,andapairofintegers(i,j),if1 2 #define HH 1 3 struct st 4 { 5 int l,r; 6 int lnum,rnum; 7 int max; 8 int lmax,rmax; 9 int color; 10 int num; 11 } f[100002*4]; 12 int d...
阅读全文
摘要:http://acm.sdibt.edu.cn/JudgeOnline/problem.php?id=3237Problem H:Boring CountingTime Limit: 3 SecMemory Limit: 128 MBSubmit: 6Solved: 2[Submit][Status][Discuss]DescriptionIn this problem you are given a number sequence P consisting of N integer and Pi is the ith element in the sequence. Now you task
阅读全文
摘要:1.统计颜色,或运算的运用2.区间第k大数3.一个很经典的题5.求区间相等数字的个数6.RMQ模板题,区间最大值和最小值的差1.很好的思路,用或运算来避免左右儿子树总相同颜色的情况。由于T颜色种类最多30种,__int64 足够用了。注意初始化就行。5.关键是写对make_up()这个函数,向上更新需要考虑的问题。经典题型。1001 1 /* 2 3 求区间[l,r]中,颜色的总类。 4 如何避免重复?----或运算。 5 6 */ 7 8 #include 9 #include 10 #include 11 #include 12 #define HH 1 13 us...
阅读全文
摘要:1.内存控制2.敌兵布阵4.广告牌5.区间第k大数(模板题)6.just a Hook7.I Hate It8.动态的最长递增子序列(区间更新题)9.图灵树10.覆盖的面积14.买票问题16.村庄问题17.Hotel19.矩形周长问题23.区间第k大数问题26.海报问题1001 1 /* 2 3 内存控制 4 4种操作: 5 1.Reset 初始化 6 2.New x 开辟长度为x的连续的空间,输出起始位置 7 3.Free x 释放包含第x字节的块,整块都释放掉 8 4.Get x 输出当前状态下,内存里第x块的起始位置 9 10 思路: 11 1.Reset 很简单...
阅读全文
摘要:PictureTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2144Accepted Submission(s): 1139Problem DescriptionA number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizo
阅读全文
摘要:Memory ControlTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3610Accepted Submission(s): 841Problem DescriptionMemory units are numbered from 1 up to N.A sequence of memory units is called a memory block. The memory control system we consider now
阅读全文
摘要:Turing TreeTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2592Accepted Submission(s): 884Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solu
阅读全文
摘要:Mayor's postersTime Limit:1000MSMemory Limit:65536KTotal Submissions:32662Accepted:9488DescriptionThe 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. The city council has finally
阅读全文
摘要:http://poj.org/problem?id=3667HotelTime Limit:3000MSMemory Limit:65536KTotal Submissions:8874Accepted:3769DescriptionThe cows are journeying north to ...
阅读全文
摘要:Sequence operationTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4393Accepted Submission(s): 1272Problem Descriptionlxhgww got a sequence contains n characters which are all '0's or '1's.We have five operations here:Change operati
阅读全文
摘要:Black And WhiteTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3561Accepted Submission(s): 1062Pro...
阅读全文
摘要:LCISTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2640Accepted Submission(s): 1143Problem Descri...
阅读全文
摘要:Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6471Accepted Submission(s): 3940Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai
阅读全文
摘要:http://acm.hrbeu.edu.cn/index.php?act=problem&id=1008&cid=115线段树,标记。How ManyTimeLimit: 10 Second MemoryLimit: 32 MegabyteTotalsubmit: 188 Accepted: 35 Descriptionyou are given a sequence A[1], A[2],..., A[N]. On this sequence you have to apply M operations: Add all the elements whose positio
阅读全文
摘要:这道题,做了好几次,彻头彻尾的经典线段树。#include<stdio.h>#define HH 1struct st{ __int64 l; __int64 r; __int64 color; __int64 num; __int64 sum;}f[100001*4];__int64 date[100002];void build(__int64 l,__int64 r,__int64 n){ __int64 mid=(l+r)/2; f[n].l=l; f[n].r=r; f[n].color=0; f[n].num=0; ...
阅读全文
摘要:这道题居然以dota为背景,很受寝室同学的关注。自己写的延迟,后来发现错误了,看了ppt的思想,该写了好久。1A#includestruct st{ int l; int r; int color; int num;}f[100002*4];int sum1;#define ...
阅读全文
摘要:学习线段树,把以前的树状数组也复习一下。Minimum Inversion Number求最小的逆序数#include<stdio.h>struct st{ int l; int r; int sum;}f[4*5002];int date[5002];void build(int l,int r,int n){ int mid=(l+r)/2; f[n].l=l; f[n].r=r; if(l==r) f[n].sum=date[l]; else { build(l,mid,n*2); build...
阅读全文
浙公网安备 33010602011771号