[BOJ 15452] Drama
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
4
Time limit:
2.0s
Memory limit:
512M
Problem types
Allowed languages
Vera has a grid with H rows and N columns. Rows are numbered 1 to H and columns are numbered 1 to N. Let the cell in the r-th row and c-th column be (r, c). Cells are coloured white or black. A colouring is a pyramid if:</p>
- Exactly N cells are black.
- (1, 1) is black.
- If (r, a) and (r, b) are black, then (r, k) is black for a < k < b.
- If (r, c) is black, then (r − 1, c), if it exists, is black.
- If (r, c) is black and there is no k < c such that (r, k) is black, then (r + 1, c), if it exists, is white.
Two pyramids are different if there is a cell that is white in one pyramid and black in the other. Compute the number of different pyramids modulo 109 + 7.
입력 형식
Line 1 contains integers H and N (1 ≤ H, N ≤ 105).
출력 형식
Print one line with one integer, the number of different pyramids modulo 109 + 7.
예제 입력 1
2 6
예제 출력 1
7
예제 입력 2
3 20
예제 출력 2
487
힌트
For the first example, the seven pyramids are:
###### ####.. ####.. #####. #####. #####. #####. ...... .##... ..##.. .#.... ..#... ...#.. ....#.
Comments