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

11704번 - Three-way Branch 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
7 초 64 MB182266.667%

문제

There is a grid that consists of W × H cells. The upper-left-most cell is (1, 1). You are standing on the cell of (1, 1) and you are going to move to cell of (W, H). You can only move to adjacent lower-left, lower or lower-right cells.

There are obstructions on several cells. You can not move to it. You cannot move out the grid, either. Write a program that outputs the number of ways to reach (W, H) modulo 1,000,000,009. You can assume that there is no obstruction at (1, 1).

입력

The first line contains three integers, the width W, the height H, and the number of obstructions N. (1 ≤ W ≤ 75, 2 ≤ H ≤ 1018, 0 ≤ N ≤ 30) Each of following N lines contains 2 integers, denoting the position of an obstruction (xi, yi).

The last test case is followed by a line containing three zeros.

출력

For each test case, print its case number and the number of ways to reach (W, H) modulo 1,000,000,009.

제한

예제 입력 1

2 4 1
2 1
2 2 1
2 2
0 0 0

예제 출력 1

Case 1: 4
Case 2: 0

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Spring Contest > JAG Spring Contest 2012 I번

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

출처

대학교 대회

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

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