Ahmet.K37's blog

By Ahmet.K37, history, 6 years ago, In English

Saturday there will be COCI exam in this link: http://hsin.hr/coci/ You can study for the old COCI's here: https://oj.uz/problems/source/122 Also this site has an online judge. The contest will begin at:15.12.2018.14:00 GMT/UTC and it will take three hours.The registerations have begun. Good luck to everyone! NOTE: There will be Educational Codeforces Round 56 (Rated for Div. 2) at the same time Please do the Educational Codeforces Round 56 (Rated for Div. 2) a bit earlier or later.

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

| Write comment?
»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Please do the contest another time.

»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Maybe it will be on Monday or at 2.00 pm.

»
6 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Auto comment: topic has been updated by Ahmet.K37 (previous revision, new revision, compare).

»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

How to solve D?

  • »
    »
    6 years ago, # ^ |
      Vote: I like it +13 Vote: I do not like it
    Here's how I solved C
    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +17 Vote: I do not like it

      For C, I wrote a greedy + randomize solution. I always choose a row/column which contributes to the current number of lamps turned on best when I flip all lamps on that row/column.

      In case the best row/column contributes zero, I choose a random one inside rows/columns which contribute zero. I do this because in the case below:

      ox

      xo

      we must flip at least one row/column at first. After that, it is easy to get a board full of lamps turned on.

      I made these operations under a 4.8 seconds loop and passed all the cases. I actually could not prove it yet but guess that number of iterations will not be too much.

  • »
    »
    6 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it
    Solution to D
    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I also used a map for intervals for each row, but I cleared it out for each new row, so overall its size is upto K at any time, so I'm not sure where the memory issue is. I don't see what's false in this approach, but I can't tell since I ended up with WA for every test case...

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

        Oh right, I'd completely missed that the order of the loops can be swapped so that row is the outer loop and circle is the inner loop. That makes the memory concern go away.

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve E?

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

      Wow my solution was so close yet so far :)

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to Solve B for Full Score?

  • »
    »
    6 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Just return the smallest difference between two consecutive numbers in the input.