#1389 : Sewage Treatment 时间限制:2000ms 单点时限:2000ms 内存限制:256MB 描述 After years of suffering, people could not tolerate the pollution in the city any more, and started a long-lasting protest. Eventually, the municipal government made up its mind to deal w…
#1391 : Countries 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 There are two antagonistic countries, country A and country B. They are in a war, and keep launching missiles towards each other. It is known that country A will launch N missiles. The i-th miss…
#1392 : War Chess 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 Rainbow loves to play kinds of War Chess games. There are many famous War Chess games such as "Biography of Cao Cao", "Anecdotes of Wagang Mountain", etc. In this problem, let's c…
#1582 : Territorial Dispute 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 In 2333, the C++ Empire and the Java Republic become the most powerful country in the world. They compete with each other in the colonizing the Mars. There are n colonies on the Mars,…
#1584 : Bounce 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 For Argo, it is very interesting watching a circle bouncing in a rectangle. As shown in the figure below, the rectangle is divided into N×M grids, and the circle fits exactly one grid. The bouncing…
#1578 : Visiting Peking University 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 Ming is going to travel for n days and the date of these days can be represented by n integers: 0, 1, 2, …, n-1. He plans to spend m consecutive days(2 ≤ m ≤ n)in Beijing. Durin…
#1586 : Minimum 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 You are given a list of integers a0, a1, …, a2^k-1. You need to support two types of queries: 1. Output Minx,y∈[l,r] {ax∙ay}. 2. Let ax=y. 输入 The first line is an integer T, indicating the number…
https://hihocoder.com/problemset/problem/1586 线段树操作,原来题并不难..... 当时忽略了一个重要问题,就是ax*ay要最小时,x.y可以相等,那就简单了!结果显然是模最小的数的平方或者是个负数. 要求乘积最小只要求区间内最大值.最小值和绝对值小的数,再判断min,max正负就行了. 下面的代码相当于建了三个树分别存Min,Max,Mid(abs(Min)) #include<iostream> #include<cstdio> #i…
题意:平面上n个点,问你是否存在一种黑白染色方案,使得对于该方案,无法使用一条直线使得黑色点划分在直线一侧,白色点划分在另一侧.如果存在,输出一种方案. 如果n<=2,显然不存在. 如果所有点共线,且n>2,只需交替染色即可. 设凸包上的点数为K,如果K==n,且n==3,不存在,如果n>3,只需交替染色即可. 如果K<n,只需凸包上点涂黑,内部点留白即可. #include<cstdio> #include<algorithm> #include<c…
题意:给你一个序列(长度不超过2^17),支持两种操作:单点修改:询问区间中最小的ai*aj是多少(i可以等于j). 只需要线段树维护区间最小值和最大值,如果最小值大于等于0,那答案就是minv*minv: 如果最大值小于等于零,那么答案就是maxv*maxv: 要是最小值小于零,最大值大于零,答案就是minv*maxv. #include<cstdio> #include<cstring> #include<algorithm> using namespace std…