线段树
dregs_
小菜鸟
展开
-
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 person is your subordinate, and all his subordinates are原创 2020-08-30 18:54:47 · 505 阅读 · 0 评论 -
Tunnel Warfare
在抗日战争期间,华北平原广大地区进行了大规模的隧道战。 一般来说,通过隧道连接的村庄排成一列。 除了两端,每个村庄都与两个相邻的村庄直接相连。 入侵者经常对一些村庄发动袭击并摧毁其中的部分隧道。 八路军指挥官要求最新的隧道和村庄连接状态。 如果某些村庄严重隔离,必须立即恢复连接! Input 输入的第一行包含两个正整数n和m(n,m≤50,000),表示村庄和事件的数量。 接下来的m行中的每一行描述一个事件。 以下所示的不同格式描述了三种不同的事件: D x:第x个村庄被毁。 Q x:指挥官询问第x个村庄与原创 2020-08-30 13:38:40 · 299 阅读 · 0 评论 -
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 endurance. For every attack of our secret weapon, it could原创 2020-08-29 22:26:49 · 148 阅读 · 0 评论 -
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. Input The first line of each data set contains exactly one in原创 2020-08-29 15:54:26 · 105 阅读 · 0 评论 -
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 sum of numbers in a given interval. Input The first line c原创 2020-08-27 23:49:48 · 136 阅读 · 0 评论