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

I guessed - can someone explain why?
Posted by Steve 24 Jun 2013 06:37
I got AC on this simply by guessing that combining the stripies from the largest down to the smallest would result in the smallest colony size. Can someone explain what mathematical or logical reasoning would be used to arrive at this conclusion, or prove that this conclusion would be true?
Re: I guessed - can someone explain why?
Posted by mberdyshev 12 Jan 2016 23:18
I guessed the same and also I want to know mathematical proof
Re: I guessed - can someone explain why?
Posted by stomakun 21 Mar 2016 20:13
The factor 2 does not matter -- you will always find one 2 which was sqrt'ed (n-1) times, ..., one 2 not sqrt'ed.
OOH, there will be exactly two given number which got sqrt'ed (n-1) times, ..., one given number that got sqrt'ed once.
Therefore, you will want larger numbers be sqrt'ed more times.


Edited by author 22.03.2016 12:08
Re: I guessed - can someone explain why?
Posted by IlushaMax 30 Mar 2017 21:34
I can explain
Okay, we have sequence m1,m2,m3,m4.... of weights in input
But now imagine that we have a heap of stripies with their weights.
Our answer (for example n=4) will be:
2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) for greater understanding write it on a sheet.
So we need to maximize it but we don't know order of m1,m2,m3,... which give max answer.
It's clear that if 2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) should be maximum then m1*2*sqrt(m2*2*sqrt(m3*m4)) (in sqrt) should be maximum too.
Reasoning in this way we understand that we need m3*m4 be maximum. So this sequence should be sorted in this way: m4>=m3>=m2>=m1
I hope my English is enough to explain it))))

Edited by author 31.03.2017 19:50