codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1288C.md (1182B)


      1 Source: https://codeforces.com/problemset/problem/1288/C
      2 
      3 C. Two Arrays
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given two integers $n$ and $m$. Calculate the number of pairs of arrays $(a, b)$ such that:
     22 
     23 * the length of both arrays is equal to $m$;
     24 * each element of each array is an integer between $1$ and $n$ (inclusive);
     25 * $a_i \le b_i$ for any index $i$ from $1$ to $m$;
     26 * array $a$ is sorted in non-descending order;
     27 * array $b$ is sorted in non-ascending order.
     28 
     29 As the result can be very large, you should print it modulo $10^9+7$.
     30 
     31 Input
     32 
     33 The only line contains two integers $n$ and $m$ ($1 \le n \le 1000$, $1 \le m \le 10$).
     34 
     35 Output
     36 
     37 Print one integer – the number of arrays $a$ and $b$ satisfying the conditions described above modulo $10^9+7$.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 2 2
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 5
     51 ```
     52 
     53 Input
     54 
     55 ```
     56 10 1
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 55
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 723 9
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 157557417
     75 ```
     76 
     77 Note
     78 
     79 In the first test there are $5$ suitable arrays:
     80 
     81 * $a = [1, 1], b = [2, 2]$;
     82 * $a = [1, 2], b = [2, 2]$;
     83 * $a = [2, 2], b = [2, 2]$;
     84 * $a = [1, 1], b = [2, 1]$;
     85 * $a = [1, 1], b = [1, 1]$.