Logo
(追記) (追記ここまで)

20587번 - Even rain 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB116393233.333%

문제

There are $n$ columns of width 1ドル$ touching by sides arranged from left to right. Column that is $i$-th from the left has height $h_i$.

When the rain falls, water can get stuck in some places. It happens when there are short columns between two high columns.

Formally, water will remain in every point which is neither an interior nor boundary of a column, but for which there exist points on the same height belonging to some columns both on the left and on the right.

We are interested in an area of stuck water. If heights $h_i$ are all integers, this area is an integer as well. Superstition of elderly foretells that happiness is brought when the area of stuck water is divisible by 2ドル$.

It seems it will be raining today. However, before that you plan to remove $k$ columns, i.e. change their heights to 0ドル$. How many out of $n \choose k$ possibilities of removing columns will result in area of stuck water being even? Print the result modulo 10ドル^9+7$.

입력

First line of input contains two integers $n$ and $k$ (1ドル \leq n \leq 25,000円,ドル 0ドル \leq k \leq \min(25, n - 1)$), denoting number of columns and number of columns to be removed.

Second line of input contains $n$ integers $h_1, \ldots, h_n$ (1ドル \leq h_i \leq 10^9$) --- heights of columns from left to right.

출력

You need to print one number --- number of possibilities modulo 10ドル^9+7$ to remove $k$ columns so that area of stuck water will be even.

제한

예제 입력 1

7 1
2 5 2 4 1 6 2

예제 출력 1

4

예제 입력 2

5 0
1 3 1 3 1

예제 출력 2

1

힌트

Explanation of first sample test:

Big picture on the left depicts initial setting of columns. Smaller pictures depict each of 7ドル$ possibilities of removing one column (pointed by an arrow). Grey areas depict stuck water.

In 4ドル$ cases area of stuck water (number next to each picture) is even.

출처

Camp > Petrozavodsk Programming Camp > Summer 2020 > Day 1: Warsaw U Contest K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /