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

19318번 - Binary String 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB115457.143%

문제

Rikka has a binary string with $n$ bits.

We don't know the string. The thing we know for sure is, for each $i \in \{1, 2, \ldots, m\},ドル at least one of the following is true: "there are exactly $x_i$ ones in the first $y_i$ bits" or "there are exactly $y_i$ ones in the last $x_i$ bits".

Find the number of possible binary strings modulo 998ドル,244円,353円$.

입력

The first line contains an integer $T$ which denotes the number of test cases (1ドル \leq T \leq 5$).

For each test case, the first line contains two integers $n$ and $m$ (1ドル \leq n \leq 5000,ドル 0ドル \leq m \leq 1000$).

The $i$-th of the following $m$ lines contains two integers $x_i$ and $y_i$ (0ドル \leq x_i, y_i \leq n,ドル $x_i \neq 0$ or $y_i \neq 0$).

출력

For each test case, print an integer which denotes the number of binary strings satisfying the constraints, modulo 998ドル,244円,353円$.

제한

예제 입력 1

2
3 1
2 1
5 3
1 3
4 2
3 1

예제 출력 1

4
2

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 7: Ruyi Ji Contest 3 E번

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

출처

대학교 대회

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

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