n차원에서 정렬된 목표점까지 좌표가 비감소하는 단조 격자 경로 중 주어진 정렬 장애물 m개를 피하는 경로 수를 1e9+7로 나눈 나머지로 구한다.
어려움8조합론동적 계획법수학아직 제출이 없습니다시간 제한2초메모리 제한512 MBYou want to walk from (0,0,…,0) to (a_0,a_1,…,a_n−1) in an n-dimensional space. On each step, you can increase one component of your coordinate vector by one. There are m obstacles p_1,p_2,…,p_m. You want to find the number of paths that don't pass through the obstacles.
However, this problem is too simple for an ICPC contest in the year 8102. We add one more constraint. For every point (x_0,x_1,…,x_n−1) on your path, the components of this vector should be non-decreasing: x_0≤x_1≤…≤x_n−1.
Output the number of paths modulo 109+7.
The first line contains two integers n and m (1≤n≤50, 0≤m≤50).
The second line contains n integers a_0,a_1,…,a_n−1 (0≤a_0≤a_1≤…≤a_n−1≤104), the coordinate vector of your destination.
The following m lines describe obstacles. The i-th of these lines contains n integers p_i,0,p_i,1,…,p_i,n−1 (0≤p_i,0≤p_i,1≤…≤p_i,n−1≤104), the coordinate vector of an obstacle.
The starting point, destination, and all the obstacles are distinct.
Output the answer modulo 109+7.