Hey How to solve problem B and D ? https://code.google.com/codejam/contest/6274486/dashboard#s=p1 https://code.google.com/codejam/contest/6274486/dashboard#s=p3
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
8 | Dominater069 | 154 |
8 | nor | 154 |
Hey How to solve problem B and D ? https://code.google.com/codejam/contest/6274486/dashboard#s=p1 https://code.google.com/codejam/contest/6274486/dashboard#s=p3
Название |
---|
Auto comment: topic has been updated by sanket407 (previous revision, new revision, compare).
For B, calculate dp[i][j], which denotes the size of maximum square ending at i,j. Then simply sum dp[i][[j] from i=0 to R-1 and j=0 to C-1. Calculating the above dp is explained here: http://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1s-in-a-binary-matrix/
Thanks :>> problem D any idea ?
In problem A test case 2 , how is the probability of transition from (8,3)->(8,2) = 0.23743359 . Can anyone please explain this.
0.6121*(1-0.6121). You visit (8,2) twice.
Thanks for the explanation
D:
O(n**3) solution is to compress the given values in both column so none of them goes over n.
Then if you are at state (i, j) (i is the maximum attack value and j is the maximum defence value in the already choosen set), you could try out all possible pair (soldier) you could add in O(n) and then memoize the results. This only passes small test though.
The solution to problem D is actually deceptively simple. Let's say whoever picks last wins.
If there are no soldiers, then Alice loses, because she has no moves. Otherwise, let the highest attack of the soldiers be maxA and the highest defense be maxD. We have two cases:
The straightforward O(n2) implementation is good enough, but it should be possible to implement this in by sorting the soldiers first.
You are so smart!