ko_osaga's blog

By ko_osaga, history, 8 years ago, In English

http://hsin.hr/coci

40 minutes left. Enjoy!

  • Vote: I like it
  • +49
  • Vote: I do not like it

| Write comment?
»
8 years ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

How to solve problem E?

»
8 years ago, hide # |
 
Vote: I like it +15 Vote: I do not like it

how to solve problem D for 100% ?

  • »
    »
    8 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    All you need to do is summon mkisic (task author) to the rescue :)

  • »
    »
    8 years ago, hide # ^ |
     
    Vote: I like it +10 Vote: I do not like it

    As mkisic is occupied by Maja, I will explain the solution.

    Imagine fixating a row. Now make an array where the value of a field is the number of consecutive fields empty in the up direction. So now we have a problem of findning the sum of areas of all rectangles in a histogram. We can solve the problem in two ways, one is in O(N log N) using divide and conquer and the other one is using stack in O(N).

    I will explain the divide and conquer solution. Using segment tree we can fin the minimum in an interval. Now we want to count the sum of areas of all rectangles whose botom side is in our fixated row and whose height is smaller than or equal to the smallest element in that interval. It is not hard to come up with a formula. Now we proceed with the divide and conquer on the two intervals we get by splitting at the minimum. Notice that you have to be careful not to count some rectangles twice, but this can be easily avoided.

    Insted of using the segment tree to find out those intervals, you can do a simmilar thing with a montone stack.

»
8 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Where can I submit solutions?

»
7 years ago, hide # |
Rev. 2  
Vote: I like it -29 Vote: I do not like it

deleted