Flight Boarding Optimization 题目连接: http://codeforces.com/gym/100269/attachments Description Peter is an executive boarding manager in Byteland airport. His job is to optimize the boarding process. The planes in Byteland have s rows, numbered from 1 t…
C. Subsequences Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/problem/C Description For the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed tha…
H. Milestones Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description The longest road of the Fairy Kingdom has n milestones. A long-established tradition defines a specific color for milestones in each region, with a…
树状数组维护DP + 高精度 Description These days, Sempr is crazed on one problem named Crazy Thair. Given N (1 ≤ N ≤ 50000) numbers, which are no more than 109, Crazy Thair is a group of 5 numbers {i, j, k, l, m} satisfying: 1 ≤ i < j < k < l < m ≤ N Ai…
题目传送门:http://codeforces.com/contest/799/problem/C C. Fountains time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. T…
题目链接:https://codeforces.com/problemset/problem/799/C 题意:有 c 块硬币和 d 块钻石,每种喷泉消耗硬币或钻石中的一种,每个喷泉有一个美丽值,问建造两个喷泉可以获得的最大美丽值是多少. 题解:三种情况:买两个消耗硬币的喷泉,买两个消耗钻石的喷泉或各买一个,消耗的范围是1e5,故用树状数组维护之前的最大值,考虑加入当前建造的更新答案. #include <bits/stdc++.h> using namespace std; #define…
D. Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her wit…
Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of length n and q questions. The i-th question is whether P remains balanced after p ai and p bi swapped. Note that questions are individual so that they have no affect on others. Parenthesis se…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6447 Problem DescriptionYJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination.One day, he is going to travel…
题目描述 这是一道模板题,其数据比「普通平衡树」更强. 如未特别说明,以下所有数据均为整数. 维护一个多重集 S ,初始为空,有以下几种操作: 把 x 加入 S 删除 S 中的一个 x,保证删除的 x 一定存在 求 S 中第 k 小 求 S 中有多少个元素小于 x 求 S 中小于 x 的最大数 求 S 中大于 x 的最小数 操作共 n 次. 输入格式 第一行一个整数 n,表示共有 n 次操作 . 接下来 n 行,每行为以下几种格式之一 : 0 x,把 x 加入 S 1 x,删除 S 中的一个 x…
任意门:https://nanti.jisuanke.com/t/31459 There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx , 00 ), ( 00 , yy ), ( xx , yy ). Every ti…
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6447 YJJ's Salesman Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 919 Accepted Submission(s): 290 Problem Description YJJ is a salesman who h…
我们发现任何最优解都可以是所有拔高的右端点是n,然后如果我们确定了一段序列前缀的结尾和在此之前用过的拔高我们就可以直接取最大值了然后我们在这上面转移就可以了,然后最优解用二维树状数组维护就行了 #include<cstdio> #include<cstring> #include<algorithm> #define N 10005 #define K 505 #define M 5505 using namespace std; inline int read() {…