Блог пользователя Ahmet.K37

Автор Ahmet.K37, история, 5 лет назад, По-английски

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.

  • Проголосовать: нравится
  • +18
  • Проголосовать: не нравится

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Please do the contest another time.

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Maybe it will be on Monday or at 2.00 pm.

»
5 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

How to solve D?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +13 Проголосовать: не нравится
    Here's how I solved C
    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится +17 Проголосовать: не нравится

      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.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +9 Проголосовать: не нравится
    Solution to D
    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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...

      • »
        »
        »
        »
        5 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        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.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится
    Solution
»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to Solve B for Full Score?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

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