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

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

Greetings Codeforces Community!

CodeChef’s June CookOff, sponsored by ShareChat is almost here. Prepare to face the problem set that we have been busy brewing. This is your opportunity to showcase your programming skills amidst the best programmers in the world and better your ratings.

As a bonus: ShareChat — India’s fastest growing social network is seeking both interns and full-time employees to join their dynamic team. To be considered for the roles, all you have to do is fill the form provided and participate in the contest. Visit the contest page for more details.

We are on the hunt for a Mandarin Translator to help translate problem statements for our monthly contests. This will be a long-term commitment with translations required thrice a month. If you think you are up to the task, then do get back to us at problems@codechef.com.

There’s no time to waste, so start flexing your programming muscle. I hope you will join your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

  • Setters: kingofnumbers (Hasan Jaddouh), Erfan.aa (Erfan Alimohammadi), solaimanope (Mohammad Solaiman)

  • Tester and Editorialist: teja349 (Teja Vardhan Reddy)

  • Statement Verifier: Xellos (Jakub Safin)

  • Mandarin Translator: huzecong (Hu Zecong)

  • Vietnamese Translator: Team VNOI

  • Russian Translator: Mediocrity (Fedor Korobeinikov)

  • Bengali Translator: solaimanope (Mohammad Solaiman)

  • Hindi Translator: Akash Shrivastava

Contest Details:

  • Start Date & Time: 23rd June 2019 (2130 hrs) to 24th June 2019 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone

  • Contest link: https://www.codechef.com/COOK107

  • 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 top 10 performers in Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: https://discuss.codechef.com/t/how-do-i-win-a-codechef-goodie/7344

(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!!

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

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

Thanks for the contest!

My thoughts on Div 2: I felt the problem quality was generally strong, but the difficulty distribution could have been a bit better. In particular, it seemed like there were three easy problems, one medium-easy problem, and one particularly hard problem. Although the hard problem was particularly nice, it was a fair bit more difficult than most problems on the late end of Codechef Division 2 rounds.

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

Hi everyone. So, for question SUBSETS, my approach was as follows:

  1. Precompute (sieve) all primes upto $$$10^{\dfrac{16}{3}}$$$ which is roughly $$$220000$$$.
  2. Then I will see (i,j) pairs, such that they form not special pair.
  3. Then subtract these cases from total $$$2^N$$$.

UPD: (Adding more about how I was/am calculating bad subsets)

Example:

$$$N=4$$$, $$$A$$$$$$=$$${$$$1,4,8,20$$$}

Initialize $$$cnt=N-2=2$$$

So, first I see that $$$(1,4)$$$ has no problem, then $$$(1,8)$$$ is a problem, so I subtract $$$2^{cnt}$$$ ( number of subsets with $$$1$$$ AND $$$8$$$, and decrease $$$cnt$$$ (now $$$cnt=1$$$), then $$$(1,20)$$$ no issue.

Again $$$cnt=N-2=2$$$. Now consider $$$(4,8)$$$, since I have considered all values to left of $$$4$$$, it means if some value to left of $$$4$$$ has problem with $$$4$$$ or $$$8$$$ then I have already counted its subsets, and I shouldn't count again. So I check to left of $$$4$$$, how many values have problem with either $$$4$$$ or $$$8$$$, let's denote it as $$$done$$$. Then $$$cnt=N-2-done$$$, and $$$(4,8)$$$ is problem, so subtract $$$2^{cnt}$$$ and decrease $$$cnt$$$ for $$$(4,20)$$$. And so on.

So, in all I do this, $$$ans=2^N=16$$$.

  1. $$$(1,4)$$$ => no change
  2. $$$(1,8)$$$ => -4
  3. $$$(1,20)$$$ => no change
  4. $$$(4,8)$$$ => -2 ( 1 already counted with 4 )
  5. $$$(4,20)$$$ => -2 ( 1 already counted with 4 )
  6. $$$(8,20)$$$ => -1 ( 1 already counted with 8, 4 already counted with 8 )

So, final change is $$$(-9)$$$. $$$ans = 7$$$.

But, I had a lot of trouble calculating what to subtract. Can someone help me with this?

My code : here

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

Can anyone explain the solution of Secret Recipe

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

    We essentially have two cases.

    1. The chef runs directly away from a single enemy but eventually gets caught without assistance from any other enemies. Obviously, this enemy must be faster than the chef.

    2. Two enemies run towards the chef from different directions. The chef runs to the point where the two enemies meet and gets caught when the enemies meet at that point. (If the chef can't make it to that midpoint before getting caught by one of the enemies, this is equivalent to case #1.)

    Computing the minimum time it would take for the chef to be caught in any of the Case #1 scenarios can easily be done in O(N) with some basic math. Case #2 is a bit more complicated because we have O(N^2) pairs of enemies that could help catch the chef. The problem we have now is finding the appropriate pair to catch the chef fastest.

    Surprisingly, binary search helps us accomplish this task. We binary search on the answer, the time it takes for the chef to be caught. Suppose we want to check whether the chef can be found in T seconds. Then, we pick the best enemy to run in each direction by selecting the one who will get the furthest running in that direction, based on their starting position and T times their velocity.

    If the best enemy to run towards lower positions is a different enemy from the one best suited to running towards higher positions, we can simply check whether these two chefs can meet within T seconds. If the same enemy can get to the lowest or the highest position of any of the enemies, though, we do casework on whether this particular enemy will run towards lower or higher positions. In each case, we pick the remaining enemy best at running in the opposite direction and check whether this enemy, along with our best enemy, can catch the chef in T seconds. If neither of these cases allow us to catch the chef in T seconds, then doing so is impossible.

    Finally, to get our answer, we simply take the minimum of the answers given by our two original cases.

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

I'm very curious to hear about the thoughts of Div 1 coders who left Secret Recipe for last. As a Div 2 participant, I didn't find it ridiculously hard, but it was the least solved problem in both divisions. The questions SUBSETS and IDXSUM seem much harder conceptually from a quick glance at their editorials.

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

How to solve slush question without Bi < Fi constraint (Bi and Fi can be any value between 0 and 1e5)?

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

    This wouldn't change the solution in any way, as the problem stipulates that Chef must sell a customer their favorite flavor if that flavor is in stock. So, whether we add Bi or Fi doesn't depend on their values--only on which flavors are available.

    EDIT: This is incorrect, see the below comment. I suspect that this problem actually becomes rather difficult with this constraint eliminated, and maybe even impossible with the given input size and time limit. I'll think about it some more and will post an update if I come up with a solution.