https://code.google.com/codejam/contest/4284487/dashboard
Brute force. Simple.
Intervals intersection.
Take care of p=0 and p=100. Use long
instead of double
.
DP/DFS with memorization.
dp[i][x] means, can we put x in first i rounds. Here x records people
(one in a bit).
To solve this, just break x into two numbers y and z, then check dp[i-1][y]
and dp[i-1][z]. Check all possible subsets.
Return dp[n][(1<<n)-1]
.
First, solve the problem Sliding Window Maximum.
Then, just apply it to each row, then each col.