#P2984. strip
strip
题目描述
给一条长为N~10^18的纸带,从左到右每个整数的位置标号为0..N,接下来有K~1W个操作,每次选取位置X,将整条纸带在X处对折。如果X是边缘则什么也不做。问最后纸带长度。
9 5
5 9 2 8 3
2
数据范围与约定
The segment names look as follows:
Starting situation: {0 1 2 3 4 5 6 7 8 9}.
Consecutively applying the folds:
The segment names look as follows:
Starting situation: {0 1 2 3 4 5 6 7 8 9}.
Consecutively applying the folds:
--> {0 (1;9) (2;8) (3;7) (4;6) 5} --> {(1;9) (0;2;8) (3;7) (4;6) 5} --> {(0;2;8) (1;3;7;9) (4;6) 5} -->
{(0;2;8) (1;3;7;9) (4;6) 5} --> {(1;3;7;9) (0;2;4;6;8) 5}.