1325: 【回溯】填色问题

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:45 Solved:1

Description

有一张包含N(N≤10)块区域的地图,给出M(M≤50)个描述,每组描述A,B表示A,B相邻,相邻的区域不能染同一种颜色,一种有四种颜色,请你用这四种颜色给地图染色,一共有多少中染色方法?

Input

第一行两个数N和M
接下来M行,每行一组数A,B表示A,B相邻

Output

个数表示染色方法数

Sample Input Copy

5 4
1 2
1 3
1 4
1 5

Sample Output Copy

324

Source/Category