
线段树
文章平均质量分 73
Ant_e_zz
这个作者很懒,什么都没留下…
展开
-
F - Count the Colors
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last. ...原创 2018-07-23 10:27:15 · 344 阅读 · 0 评论 -
N - Picture POJ - 1177
A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle can be partially or totally covered b...原创 2018-08-05 15:48:33 · 457 阅读 · 0 评论 -
O - 覆盖的面积 HDU - 1255
给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一行包含四个浮点数,代表平面上的一个矩形的左上角坐标和右下角坐标,矩形的上下边和X轴平行,左右边和Y轴平行.坐标的范...原创 2018-08-05 15:49:15 · 290 阅读 · 0 评论 -
P - Atlantis HDU - 1542
There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe diff...原创 2018-08-05 15:49:51 · 213 阅读 · 0 评论 -
Q - Get The Treasury HDU - 3642
Problem DescriptionJack knows that there is a great underground treasury in a secret region. And he has a special device that can be used to detect treasury under the surface of the earth. One day h...原创 2018-08-06 03:03:35 · 262 阅读 · 0 评论 -
L - Vases and Flowers
Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one flower in one vase. ...原创 2018-08-01 11:41:26 · 198 阅读 · 0 评论 -
1989. Subpalindromes
Time limit: 0.5 secondMemory limit: 64 MBYou have a string and queries of two types:replace i’th character of the string by character a; check if substring sj...sk is a palindrome.InputThe fi...原创 2018-08-10 13:31:48 · 329 阅读 · 0 评论 -
L - Vases and Flowers
Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one flower in one vase. ...原创 2018-08-02 12:59:10 · 342 阅读 · 0 评论 -
A - 敌兵布阵 (非递归版本的线段树)
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...原创 2018-08-11 13:38:15 · 287 阅读 · 0 评论 -
M - 约会安排
寒假来了,又到了小明和女神们约会的季节。 小明虽为屌丝级码农,但非常活跃,女神们常常在小明网上的大段发言后热情回复“呵呵”,所以,小明的最爱就是和女神们约会。与此同时,也有很多基友找他开黑,由于数量实在过于巨大,怎么安排时间便成了小明的一大心事。 我们已知小明一共有T的空闲时间,期间会有很多女神或者基友来找小明。 作为一个操作系统曾经怒考71分的大神,小明想到了一个算法,即“...原创 2018-08-02 20:47:52 · 391 阅读 · 0 评论 -
B - I Hate It (非递归版)
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5...原创 2018-08-12 13:10:22 · 257 阅读 · 0 评论 -
C - A Simple Problem with Integers (非递归版)
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the ...原创 2018-08-12 13:36:18 · 253 阅读 · 0 评论 -
P2023 [AHOI2009]维护序列
题目描述老师交给小可可一个维护数列的任务,现在小可可希望你来帮他完成。 有长为N的数列,不妨设为a1,a2,…,aN 。有如下三种操作形式: (1)把数列中的一段数全部乘一个值; (2)把数列中的一段数全部加一个值; (3)询问数列中的一段数的和,由于答案可能很大,你只需输出这个数模P的值。输入输出格式输入格式: 第一行两个整数N和P(1≤P≤1000000000)。 第二行含...原创 2018-08-09 10:47:02 · 284 阅读 · 0 评论 -
P1972 [SDOI2009]HH的项链
题目背景无题目描述HH 有一串由各种漂亮的贝壳组成的项链。HH 相信不同的贝壳会带来好运,所以每次散步完后,他都会随意取出一段贝壳,思考它们所表达的含义。HH 不断地收集新的贝壳,因此,他的项链变得越来越长。有一天,他突然提出了一个问题:某一段贝壳中,包含了多少种不同的贝壳?这个问题很难回答……因为项链实在是太长了。于是,他只好求助睿智的你,来解决这个问题。输入输出格式输入格式...原创 2018-08-09 10:46:16 · 183 阅读 · 0 评论 -
G - Balanced Lineup
For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things ...原创 2018-07-23 19:15:50 · 284 阅读 · 0 评论 -
H - Can you answer these queries?
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of end...原创 2018-07-23 20:17:41 · 204 阅读 · 0 评论 -
I - Tunnel Warfare
During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t...原创 2018-07-24 22:16:51 · 433 阅读 · 0 评论 -
J - Assign the task
There is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the leader of whole company).If you are the immediate boss of someone,that ...原创 2018-07-24 23:47:36 · 245 阅读 · 0 评论 -
K - Transformation
Yuanfang is puzzled with the question below: There are n integers, a 1, a 2, …, a n. The initial values of them are 0. There are four kinds of operations. Operation 1: Add c to each number between a...原创 2018-07-26 09:59:00 · 257 阅读 · 0 评论 -
B - I Hate It
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5...原创 2018-07-22 12:45:38 · 264 阅读 · 0 评论 -
A - 敌兵布阵
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...原创 2018-07-22 13:21:54 · 851 阅读 · 0 评论 -
C - A Simple Problem with Integers
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the ...原创 2018-07-22 14:20:04 · 224 阅读 · 0 评论 -
D - Mayor's posters
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. The city council has finally d...原创 2018-07-22 19:03:34 · 214 阅读 · 0 评论 -
E - Just a Hook
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. Now Pud...原创 2018-07-22 19:55:54 · 274 阅读 · 0 评论 -
P1198 [JSOI2008]最大数
题目描述现在请求你维护一个数列,要求提供以下两种操作:1、 查询操作。语法:Q L功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值。限制: LL 不超过当前数列的长度。 (L > 0)(L>0)2、 插入操作。语法:A n功能:将 nn 加上 tt ,其中 tt 是最近一次查询操作的答案(如果还未执行过查询操作,则 t=0t=0 ),并将所得...原创 2018-08-09 10:45:37 · 214 阅读 · 0 评论 -
Codeforces 527C Glass Carvi
#include<bits/stdc++.h>#define ls l, mid, rt << 1#define rs mid + 1, r, rt << 1 | 1using namespace std;const int MAXN = 200000 + 10;struct f{ int maxx; int ll, rr; int l, ...原创 2018-08-12 19:52:04 · 322 阅读 · 0 评论