ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1161. Stripies

DP?
Posted by nYz]LL_taO 27 Sep 2007 12:51
Did you use DP to solve this problem?
How did you do it?
Re: DP?
Posted by jagatsastry 19 Nov 2007 01:53
use greedy algo instead.
choose the largest numbers for the innermost square roots so that their values get depreciated with each iteration.
this is how i did.
sort arr in reverse order

[code deleted]

cur is the final answer

Edited by moderator 19.10.2019 19:45
Re: DP?
Posted by jk_qq 22 Dec 2013 06:15
you can use dp in this task, like in the classical task "how to multiply n matrices in optimal way". it's O(n^3), so suitable.

also there's greddy algorithm, O(n).