C. Remove Extra One time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a permutation p of length n. Remove one element from permutation to make the number of records the maximum…
题目链接 题意:让你去掉一个数,使得剩下的数的record最多,当1≤j<i的aj<ai1 \leq j< i的a_j<a_i1≤j<i的aj​<ai​时aia_iai​为recordrecordrecord数. 解法:遍历数组每个数,记录最大和次大值,用cntcntcnt数组记录,移除某个数后造成的recordrecordrecord数变化量.然后输出最优的即可. #include<bits/stdc++.h> #define LL long long #…
A. Find Extra One time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the…
Codeforces Round #450 (Div. 2) http://codeforces.com/contest/900 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define pb push_back #define eb emplace_back #…
Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bough…
这次还是能看的0 0,没出现一题掉分情况. QAQ前两次掉分还被hack了0 0,两行清泪. A. Find Extra One   You have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis. Inp…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 枚举删除第i个数字. 想想删掉这个数字后会有什么影响? 首先,如果a[i]如果是a[1..i]中最大的数字 那么record会减少1. 其次. 对于任意一个a[j],且i<j且a[i]是a[1..j]中最大的数字,且a[j]是a[1..j]中第二大的数字. 删掉a[i]后,a[j]都会成为一个record,即record数递增. 则我们可以预处理一下. 遍历a 对于a[i] 看看它是不是a[1..i]中第二小的数字. 那么标记c…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟. 看看Y左边或右边的点个数是否<=1 [代码] #include <bits/stdc++.h> using namespace std; const int N = 1e5; int a[N+10]; int main(){ #ifdef LOCAL_DEFINE freopen("F:\\c++source\\rush_in.txt", "r", stdin); #end…
链接: https://codeforces.com/contest/1272/problem/D 题意: You are given an array a consisting of n integers. You can remove at most one element from this array. Thus, the final length of the array is n−1 or n. Your task is to calculate the maximum possib…
题目链接: http://codeforces.com/contest/900/problem/D 题意: 给你 \(x\) 和 \(y\),让你求同时满足这两个条件的序列的个数: \(a_1, a_2, ..., a_n (1 ≤ a_i)\). $ 1.$ $gcd(a_1, a_2, ..., a_n) = x $ $ 2.$ \(\sum_{i=1}^{n}a_i = y\) 题解: 可以发现,当\(y\%x!=0\)时,满足条件的序列不存在.让\(f(t)\)表示满足序列和为的 \(t…