F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Blank

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 2537    Accepted Submission(s): 897


Problem Description
There are $N$ blanks arranged in a row. The blanks are numbered $ 1, 2, \ldots , N $ from left to right.
Tom is filling each blank with one number in $\{0, 1, 2, 3\}$. According to his thought, the following $M$ conditions must all be satisfied. The $i_{th}$ condition is:
There are exactly $x_i$ different numbers among blanks $\in [l_i,r_i]$.
In how many ways can the blanks be filled to satisfy all the conditions? Find the answer modulo $998244353$.
 

Input
The first line of the input contains an integer $T(1\le T \le 15)$, denoting the number of test cases.
In each test case, there are two integers $n(1 \le n \le 100)$ and $m(0 \le m \le 100)$ in the first line, denoting the number of blanks and the number of conditions.
For the following $m$ lines, each line contains three integers $l, r$ and $x$, denoting a condition$(1 \le l \le r \le n$, $1 \le x \le 4)$.
 

Output
For each testcase, output a single line containing an integer, denoting the number of ways to paint the blanks satisfying all the conditions modulo $998244353$.
 

Sample Input
2 1 0 4 1 1 3 3
 

Sample Output
4 96
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-21 17:57:42, Gzip enabled