Moderator: Board moderators
Anonymous wrote:wook wrote:yes, it's DP
time complexity is about o(k * n^2)
Are you sure about o(k * n^2) ?
My algo takes o(k * n^3). And work fast enough.

kp wrote:Thx, I optimized my algo. Now it's O(k * n^2) too.
However running time didn't improved much.

Larry wrote:Can someone post some example cases? Thanks!

ayon wrote:hi,
i cannot make a way to use DP in this problem. if you anyone describe how to implement DP here, i will be greatly helped. btw, can this problem be solved within time limit using dfs?
thanks in advance...
L I M O N wrote:Someone pls send some critical data, i m getting WA again and again. i use DP.
Thx in Advace.
L I M O N
1 0
1
1 0
-1
1 1
-1
3 0
1 1 1
1 1 1
1 1 1
4 0
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
4 1
1 -1 1 1
-1 1 1 1
10 -1 5 1
1 1 1 1
3 5
-1 -1 -1
-1 -1 -1
-1 -1 -1
3 4
-1 -1 -1
-1 -1 -1
-1 -1 -1
5 2
2 -1 10 3 13
5 -4 3 -2 1
-100 2 3 43 17
24 92 40 14 40
100 100 -1 -1 1
0 0
Case 1: 1
Case 2: impossible
Case 3: -1
Case 4: 9
Case 5: 13
Case 6: 14
Case 7: -5
Case 8: impossible
Case 9: 280
Users browsing this forum: No registered users and 1 guest