A. Thanos Sort
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Thanos sort is a supervillain sorting algorithm, which works as follows: if the array is not sorted,

snap your fingers* to remove the first or the second half of the items, and repeat the process.

Given an input array, what is the size of the longest sorted array you can obtain from it using Thanos sort?

*Infinity Gauntlet required.

Input

The first line of input contains a single number nn (1≤n≤161≤n≤16) — the size of the array. nn is guaranteed to be a power of 2.

The second line of input contains nn space-separated integers aiai (1≤ai≤1001≤ai≤100) — the elements of the array.

Output

Return the maximal length of a sorted array you can obtain using Thanos sort

. The elements of the array have to be sorted in non-decreasing order.

Examples
input

Copy
4
1 2 2 4
output

Copy
4
input

Copy
8
11 12 1 2 13 14 3 4
output

Copy
2
input

Copy
4
7 6 5 4
output

Copy
1
Note

In the first example the array is already sorted, so no finger snaps are required.

In the second example the array actually has a subarray of 4 sorted elements, but you can not remove elements

from different sides of the array in one finger snap. Each time you have to remove either the whole first half or th

whole second half, so you'll have to snap your fingers twice to get to a 2-element sorted array.

In the third example the array is sorted in decreasing order, so you can only save one element from the ultimate destruction.

思路:可以用递归先判断是不是排好了,如果没有,那么再看前半段或者后半段

返回最大值即可

#include<iostream>
using namespace std;
int a[];
int b[],c[],d[];
int ff(int x,int y){
int t=,sum=;
for(int i=x+;i<=y;i++){
if(a[i]>=a[i-])
sum++;
else{
t=;
}
}
if(t==)
return sum;
else
return max(ff(x,(x+y-)/),ff((x+y+)/,y));
}
int main(){
int n;
cin>>n;
for(int i=;i<=n;i++){
cin>>a[i];
}
cout<<ff(,n)<<endl;
return ;
}
B. Kanban Numbers
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

 
Input

The input contains a single integer aa (1≤a≤991≤a≤99).

Output

Output "YES" or "NO".

Examples
input

 
5
output

 
YES
input

 
13
output

 
NO
input

 
24
output

 
NO
input

 
46
output

 
YES
这个就是脑洞题了,题目信息很少,kanban数就是把数字转化为英语,
然后含有k,n,a,b的为no
没有这些字母的是yes;真是脑洞大开
C. Mystery Circuit
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Input

The input contains a single integer aa (0≤a≤150≤a≤15).

Output

Output a single integer.

Example
input

 
3
output

 
13

April Fools Day Contest 2019: editorial回顾补题的更多相关文章

  1. April Fools Day Contest 2019 A. Thanos Sort

    A. Thanos Sort time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  2. April Fools Day Contest 2014

    April Fools Day Contest 2014 A.C.H三道题目 ============================================================= ...

  3. 坑爹CF April Fools Day Contest题解

    H - A + B Strikes Back A + B is often used as an example of the easiest problem possible to show som ...

  4. April Fools Day Contest 2014 H. A + B Strikes Back

    H. A + B Strikes Back time limit per test 1 second memory limit per test 256 megabytes input standar ...

  5. April Fools Day Contest 2016 D. Rosetta Problem

    D. Rosetta Problem 题目连接: http://www.codeforces.com/contest/656/problem/D Description ++++++++[>+& ...

  6. April Fools Day Contest 2016 G. You're a Professional

    G. You're a Professional 题目连接: http://www.codeforces.com/contest/656/problem/G Description A simple ...

  7. April Fools Day Contest 2016 F. Ace It!

    F. Ace It! 题目连接: http://www.codeforces.com/contest/656/problem/F Description Input The only line of ...

  8. April Fools Day Contest 2016 E. Out of Controls

    E. Out of Controls 题目连接: http://www.codeforces.com/contest/656/problem/E Description You are given a ...

  9. April Fools Day Contest 2016 C. Without Text 信号与系统

    C. Without Text 题目连接: http://www.codeforces.com/contest/656/problem/C Description You can preview th ...

随机推荐

  1. 基于 jQuery 的专业 ASP.NET WebForms/MVC 控件库!

    目录 [第一篇]ASP.NET MVC快速入门之数据库操作(MVC5+EF6) [第二篇]ASP.NET MVC快速入门之数据注解(MVC5+EF6) [第三篇]ASP.NET MVC快速入门之安全策 ...

  2. JSP 注释的详解及简单实例

    转自:https://www.jb51.net/article/124727.htm JSP 注释的详解及简单实例 一 三种格式 二 举例 ? 1 2 3 4 5 6 7 8 9 10 11 12 1 ...

  3. ASP.NET Core MVC 打造一个简单的图书馆管理系统 (修正版)(四)图书信息的增删改查

    前言: 本系列文章主要为我之前所学知识的一次微小的实践,以我学校图书馆管理系统为雏形所作. 本系列文章主要参考资料: 微软文档:https://docs.microsoft.com/zh-cn/asp ...

  4. bzoj 4071: [Apio2015]巴邻旁之桥【splay】

    用权值线段树会容易一些并快一些,但是想复健一下splay所以打了splay 然后果然不会打了. 解题思路: 首先把家和办公室在同一侧的提出来直接加进答案里: 对于k=1,直接选所有办公室和家的中位数即 ...

  5. Ocelot(九)- 教你如何配置Ocelot?

    配置 可以在此处找到示例配置.配置有两个部分.一组ReRoutes和一个GlobalConfiguration.ReRoutes是告诉Ocelot如何处理上游请求的对象.全局配置有点hacky并允许覆 ...

  6. hasLayout原理【转】

    项目中经常用到:*html .clearfix{ height:1%;}  //IE6能识别*+html .clearfix{height:1%;} //IE7能识别1,有很多方式能触发hasLayo ...

  7. centos7静态网络配置

    centos7静态网络配置 cd /etc/sysconfig/network-scripts 找到当前网卡名字 vim ifcfg-ens33 TYPE="Ethernet" # ...

  8. Vasiliy's Multiset CodeForces -706D || 01字典树模板

    就是一个模板 注意这题有一个要求:有一个额外的0一直保持在集合中 #include<cstdio> #include<algorithm> using namespace st ...

  9. android:process用法

    1.作用 android:process将组件在新进程中运行. 2.应用范围 可以出现在<application>  <activity>, <service>,  ...

  10. 备份字段(CATALOGUE_CODE)

    update am_e4_entry set CATALOGUE_CODE_back=CATALOGUE_CODE; 还原字段 update am_e4_entry a set CATALOGUE_C ...