시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 1024 MB | 300 | 159 | 116 | 51.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
.
4 2 3 2 1 1
0
5 4 3 30 6 4 7
1
University > University of Alberta Programming Contest > UAPC 2022 E번