시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB30015911651.101%

문제

You are a leading programmer at CompanyTM, and have been given the following task. Given a list of $N$ integers $x_1, \dots ,x_N$, is their product $x_1⋅x_2⋅ \dots ⋅x_N$ even? You plug away at the problem using every trick in the book, and come up with a very elegant solution. Lo and behold, your supervisor then informs you that the task has changed! It turns out the higher ups want you to find out if the product $x_1⋅x_2⋅ \dots ⋅x_N$ is divisible by $2^K$ for some integer $K≥0$.

You just can’t catch a break!

입력

The input consists of two integers $N,K$ ($1≤N≤100000$ and $0≤K≤1000$). These are followed by $N$ lines, each with a single value $x_1, \dots ,x_N$ respectively ($1≤x_i≤10^9$ for each $1≤i≤N$) which form the product.

출력

Display 1 if $2^K$ divides $x_1⋅x_2⋅ \dots ⋅x_N$, otherwise display 0.

예제 입력 1

4 2
3
2
1
1

예제 출력 1

0

예제 입력 2

5 4
3
30
6
4
7

예제 출력 2

1

출처

University > University of Alberta Programming Contest > UAPC 2022 E번

  • 문제를 만든 사람: Noah Gergel