report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Broken board - MarisaOJ: Marisa Online Judge

Broken board

Time limit: 1000 ms
Memory limit: 256 MB
Given a chessboard with a missing corner, the dimensions are specified as follows:
![](https://marisaoj.com/media/media/br48TItriGC45WBubYQoyw.webp)
For example, with $a = b = c = d = 2$:
![](https://marisaoj.com/media/media/Nb3RH2Aw4Otzi9GyTbu97A.webp)
Count the number of ways to place $k$ rooks on the chessboard such that no two rooks can attack each other. In other words, no two rooks should be in the same row or column. ### Input - A single line containing five integers $a, b, c, d, k$. ### Output - Print an integer representing the number of valid placements modulo $10^5+3$. ### Constraints - $1 \le a,b,c,d,k \le 1000$. ### Example Input: ``` 2 2 2 2 2 ``` Output: ``` 38 ```
Introduction to combinatorics
Binomial coefficient
Fork and knife
Binomial coefficient 2
Equation
Array rearrangement
Value of subsequences
Inequation
Growing mushrooms
Binary matrix
Broken board
Triangles counting
Minecraft graph
Restricted path
Heavenly Peach Garden
Topic
Combinatorics
Rating 1600
Source LOJ
Solution (0) Solution