B. Creating the Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a problemset consisting of nn problems. The difficulty of the ii-th problem is aiai. It is guaranteed t…
B. Creating the Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a problemset consisting of nn problems. The difficulty of the ii-th problem is aiai. It is guaranteed t…
Description 给你一个单调不下降的长度为n的序列,请你找出一个最长的子序列,满足找出的子序列中,\(A_i<=A_{i-1}~\times~2\),其中i为下标,A为找出的子序列.对于一个长度为\(p\)的子序列,\(i~\in~[1,p-1]\). Input 两行,第一行是原序列的长度\(n\) 第二行是\(n\)个数,代表原序列中的\(n\)个数. Output 一行一个数,代表最长的长度 Sample Input 10 1 2 5 6 7 10 21 23 24 49 Samp…
题意: n<=2e5 思路:可以证明答案一定是极长的一段中取最大值 #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<iostream> #include<algorithm> #include<map> #include<set> #include<queue> #include<v…
http://codeforces.com/contest/1029/problem/B You are given a problemset consisting of nn problems. The difficulty of the ii-th problem is aiai. It is guaranteed that all difficulties are distinct and are given in the increasing order. You have to ass…
直接水过 #include<iostream> #include<algorithm> using namespace std; ; int a[maxn]; int n, u,maxx; int main(){ cin>>n; u=; ;i<n;++i)cin>>a[i]; ;i<n-;++i){ >=a[i+]){ ++u; } ; } } maxx=max(maxx, u); cout<<maxx<<endl;…
题目链接:http://codeforces.com/problemset/problem/1029/B 题目大意:从数组a中选出一些数组成数组b,要求 b[i+1]<=b[i]*2 . 一开始想到的是O(n^2)的动态规划,但是超时了,下面是超时的代码. #include <iostream> using namespace std; const int maxn = 200020; int n, a[maxn], f[maxn], res = 0; int main() { cin…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
Codeforces Round #506 (Div. 3) 题目总链接:https://codeforces.com/contest/1029 A. Many Equal Substrings 题意: 给出长度为n的字符串,然后要求你添加一些字符,使得有k个这样的字符串. 题解: 直接暴力吧...一个指针从1开始,另一个从2开始,逐一比较看是否相同:如果不同,第一个指针继续回到1,第二个指针从3开始...就这么一直重复.最后如果第二个指针能够顺利到最后一位,那么记录当前的第一个指针,把他后面的…