100 atcoder#ABC183C. [ABC183C] Travel
[ABC183C] Travel
Score : points
Problem Statement
There are cities. The time it takes to travel from City to City is .
Among those paths that start at City , visit all other cities exactly once, and then go back to City , how many paths take the total time of exactly to travel along?
Constraints
- If , .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer as an integer.
4 330
0 1 10 100
1 0 20 200
10 20 0 300
100 200 300 0
2
There are six paths that start at City , visit all other cities exactly once, and then go back to City :
The times it takes to travel along these paths are , , , , , and , respectively, among which two are exactly .
5 5
0 1 1 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
24
In whatever order we visit the cities, it will take the total time of to travel.