logo AlgoBeat OnlineJudge
登录 注册

#102984. [BZOJ 2984] [Balkan2009]strip

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:无测试数据
上传者: 匿名

题目描述

给一条长为 的纸带,从左到右每个整数的位置标号为 ,接下来有 个操作,每次选取位置 ,将整条纸带在 处对折。如果 是边缘则什么也不做。问最后纸带长度。

输入格式

第一行为两个整数代表

第二行有 个整数,表示 次对折的位置

输出格式

一个整数,表示最后纸带的长度。

样例

样例输入 #1

9 5 
5 9 2 8 3 

样例输出 #1

2

数据范围与提示

The segment names look as follows:

Starting situation: .

Consecutively applying the folds:

The segment names look as follows:

Starting situation: .

Consecutively applying the folds: .

对于 的数据,