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

Автор IceKnight1093, 3 года назад, По-английски

We invite you to participate in CodeChef’s Starters 96, this Wednesday, 28th June, rated till 5-stars Coders (ie. for users with rating < 2200).

Time: 8:00 PM — 10:00 PM IST

Note that the duration is 2 hours. Read about the recent CodeChef changes here.

Joining us on the problem setting panel are:

Written editorials will be available for all on CodeChef Discuss. Pro users can find the editorials directly on the problem pages after the contest.

The video editorials of the problems will be available for all users for 1 day as soon as the contest ends, after which they will be available only to Pro users.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.

Hope to see you participating. Good Luck!

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

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

Reminder: Contest starts in 2 hours!

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

Restarting codechef after a long time.

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

CodeChef,启动!

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

Okay I am going to be the first to say:

ABSOLUTEDIFF: 1842D - Тенцинг и его друзья животные

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

Where is wrong ? can u give me a test.

Remove Stones
»
3 года назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

The testcases of Remove Stones are really weak. Simply breaking the loop after a certain time passes all the testcases.

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

How to Solve Problem Swap the numbers My Logic was to use Priority Queue but not able to get Correct Answer

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

    Since you can swap ai and aj if |i-j| >= k, that means you can swap a[0] with a[k], a[k+1], ..., a[n-1], a[1] with a[k+1], a[k+2], ..., a[n-1]. Which means all indices i < n-k can be swapped with all indices j >= k. Now there are three cases. First case : If n-k >= k i.e k <= n/2 then all numbers can be swapped around which means just sort the array and return it. Second case : If k > n then no number can be swapped, so just return the original array. Third case : Put the first n-k numbers and n-1-k+1 numbers in another array, sort them. Print the first n-k numbers then print the numbers from the original array from n-k+1 to k-1 and then print the remaining arrays from the new sorted array.

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

    I used a multiset ,so I think my approach was similar to yours and I got AC. My approach--> The indexes where swap operation will NOT be allowed will follow the following condition-> (abs(i-0) <k && abs(i-(n-1) ) <k).

    I stored all these indices in a set ns (non swappable indexes) and I stored rest of the indices in another set s (swappable indexes) and their respective values in a multiset and I again traversed theses swappable indices from left to right and filled the values of the multiset on these indices in an ascending order.

    Values at non-swappable indexes will remain the same as they were in the initial array. Finally I printed the answer array. This is my submission

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

i wrote a multibfs code for ABSOLUTEDIFF which runs in O(n + m + k). I believe the idea is very stupid but it surprisingly passes. Can anyone find a counter-test or explain why it works?

code

UPD — I think the tests were weak, I found a counter-test

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

    I think the tests are weak too, I literally just simulated the $$$k$$$ constraints $$$2 \cdot n$$$ times and checked if the upper bound at least the lower bound, and it passes all test cases. If this is actually correct, I don't have a proof for this, it's just random intuition lmao. Otherwise, the tests are just bad.

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

Can someone help with ZERO ARRAY please. I read the editorial but I don't understand why it suppose to consider N is even/odd. Aren't these two cases the same for a cyclic array?

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

    No they are different. Consider the linear system:

    $$$b_0 + b_{n-1} = a_0$$$.

    $$$b_0 + b_1 = a_1$$$.

    $$$b_1 + b_2 = a_2$$$.

    ...

    $$$b_{n-2} + b_{n-1} = a_{n-1}$$$.

    Intuitively, $$$b_1 = a_1 - b_0$$$, $$$b_2 = a_2 - a_1 + b_0$$$, $$$b_3 = a_3 - a_2 + a_1 - b_0$$$, therefore the parity of $$$n$$$ matters, because it decides the sign of $$$b_0$$$ in the expression.

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

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