Блог пользователя wwwwodddd

Автор wwwwodddd, история, 7 лет назад, По-английски

Hello CodeForces Community!

As rightly said, ‘practice makes perfect’. Therefore, to help keep your programming skills in great shape, Chef is back with another contest in the form of February Cook-Off 2018 sponsored by ShareChat. In addition, there are some exciting job/internship opportunities by ShareChat for Indian programmers in the February Cook-Off 2018. For more details, you may visit the February Cook-Off contest page.

I hope you will join your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

  • Problem Setter: mgch (Misha Chorniy)
  • Problem Tester: wwwwodddd (Ke Bi)
  • Problem Editorialist: Mamedov (Rashad Mammadov)
  • Statement verifier: Xellos ( Jakub Safin)
  • Russian Translator: CherryTree (Sergey Kulik)
  • Mandarin Translator: huzecong (Hu Zecong)
  • Vietnamese Translator: VNOI Team

I hope you will enjoy solving them. Please give your feedback on the problem set in the comments below, after the contest.

Contest Details:

Time: 18th February 2018 (2130 hrs) to 19th February 2018 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.

Contest link: https://www.codechef.com/COOK91

Registration: You just need to have a CodeChef handle to participate. For all those, who are interested and do not have a CodeChef handle, are requested to register in order to participate.

Prizes: Top 10 performers in Global and Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: https://www.codechef.com/laddu.
(For those who have not yet got their previous winning, please send an email to winners@codechef.com)

Good Luck!
Hope to see you participating!!
Happy Programming!!

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

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

It was nice contest

»
7 лет назад, # |
Rev. 3   Проголосовать: нравится +9 Проголосовать: не нравится

While we were doing dp + bin search on CARRAY : wtf but correct.

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

    Even I did something similar. First sort the array. The first element has to be included in the subsequence. Then if the next element along with the previous is on or above the line, we directly include it or else we have to select a larger number. Any idea on how to prove such a greedy formally. I generally rely on intuition which is not a good idea :/

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

      This is a very common greedy approach and can easily be proved using exchange argument. Search 'exchange argument' on google.

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

How to solve CSUBSEQ?

It's easy to calculate 'chefness' and contribution of each character in O(4 * N). But I couldn't figure out how to form it into subset sum problem. Since deleting say, a character 'h' will impact contribution of every 'c' before it.

  • »
    »
    7 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +10 Проголосовать: не нравится

    do dp and maintain states such that number of ['c']['ch']['che']['chef'] seen so far.Observe that k<=32 so we do not need exact value if some value crosses k so . we can do dp in k*k*k*k*n if naively implemented.
    is it expected or any speed ups are required??
    How to solve last one??

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

      How O(nk4) solution can run in 2 sec in this problem?

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

        Isn't it 3*1e8.I think it should pass.unless your implementation is very bad.

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

      For the last one, the task turns out to disconnect an edge and calculate the minimum cost for each component.

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

      For the last one, google 2-median on tree. There are multiple papers, solving it in n log(n) time. I couldn't finish the implementation though.

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

        Hmm.. I didn't know about that. Anyway, my solution is more programming one. The hardest thing in my solution is to count the sum of numbers <= K on the segment L..R in DFS-order. You can take a look, if you can't find google paper for such method I'm going to write it.

        https://pastebin.com/d67zctRX

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

I am a beginner in CP. What will be tge approach for solving CTHREE(2nd problem)

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

    We can find all divisors of a number in . We also notice that the maximum divisors of N for N <= 10 ^ 9 is 1344. So once we have a list of all divisors for a number we can just vary the parameters x,y(as given in question), fixing x,y gives us z as N / (x * y) and we can just count the triples which satisfy the given conditions.