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

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

We invite you to participate in CodeChef’s Starters 93, this Wednesday, 7th June, rated for all coders.

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 discuss.codechef.com. 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.

We’re hiring! If you’d like to intern at CodeChef as a Learning Content Creator, click here.

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.

Are you ready to dance to the rhythm of Ariana Grande's songs while coding? We sure are! Join us for an unparalleled contest experience. And before you go, drop your favorite Ariana Grande song in the comments. Let's see which tune gets the most love!

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

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

orz

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

rivalq saar ORZ

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

Ariana Grande? I listen to Blinding lights (by TheWeeknd) more while coding.

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

can you stay up all night? (giggity)

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

My favourite song is "Break up with your girlfriend" as this song motivated me to breakup with my anime waifu and touch grass

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

Reminder: Contest starts in 3 hours.

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

"Positions"

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

"7 Rings" is the best song by Ariana Grande. Try proving me wrong!

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

In problem "GREEDY" can be replace the same character with different brackets if they are separated? i.e. can "bab" be replaced by "())" ?

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

How to solve NASA

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

Why is Kosaraju TLE'ing on SORTP9

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

    Were you storing all the edges?

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

      (⁠ノ⁠ಥ⁠,⁠_⁠」⁠ಥ⁠)⁠ノ⁠彡⁠┻⁠━⁠┻

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

      I don't think checking for SCCs is required at all. A simple DFS should be fine.

      Let $$$v_x$$$ be the node representing the value $$$x$$$, and $$$i$$$ be the node for index $$$i$$$ ($$$1 \leq i \leq N$$$).

      Observe that if an edge $$$v_a \rightarrow v_b$$$ exists, then $$$b$$$ is a submask of $$$a$$$, which means $$$\neg a$$$ is a submask of $$$\neg b$$$. So the edge $$$v_{\neg b} \rightarrow v_{\neg a}$$$ also exists.

      For simplicity, consider the path from node $$$i$$$ to $$$j$$$ that passes only through some value nodes:

      $$$ i \rightarrow v_{\neg A_i} \rightarrow v_{x_1} \rightarrow v_{x_2} \rightarrow \cdots \rightarrow v_{x_k} \rightarrow v_{A_j} \rightarrow j $$$

      It's easy to see that a path from $$$j$$$ to $$$i$$$ is guaranteed to exist:

      $$$ j \rightarrow v_{\neg A_j} \rightarrow v_{\neg x_k} \rightarrow \cdots \rightarrow v_{\neg x_2} \rightarrow v_{\neg x_1} \rightarrow v_{A_i} \rightarrow i $$$

      Or instead: proof by AC :)

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

In Thank U, Next, why is distance the number of nodes and not the number of edges in the path?

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

What is the logic for Thank U, Next

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

NASA can be just solved by this lmao:

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

How to solve Greedy ?

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

    Using DP.

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

    Notice that the string can be split into maximal segments of consecutive characters. In each such segment, all characters must be equal to each other, but characters for all segments can be chosen independently of each other.

    Now, consider some bracket sequence. Convert this into a sequence of integers: ( gets replaced by $$$1$$$, ) gets replaced by $$$-1$$$. Now, the bracket sequence is an RBS iff

    • all prefix sums are non-negative, and
    • the sum of all elements is zero.

    Since all characters within a segment need to be equal, a segment of length $$$len$$$ will change the prefix sum by $$$+len$$$ or $$$-len$$$. $$$-len$$$ is not possible, if this would make the prefix sum negative.

    Now, we create an array containing the lengths of all segmets of equal characters (in order). Now, we calculate all possible prefix sum values at the end of each segment using knapsack dp in $$$O(n\cdot \text{number of segments}) = O(n^2)$$$. If we can get a prefix sum equal to $$$0$$$ at the end, a solution exists. We can find this by doing backtracking on the dp array.

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

Why was this contest rated for 7-star coders, above other Starters? I felt the problems were quite easy for a "div 1" contest.

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

    It is true that this contest was easier than some previous "Rated for All" Starters. But as mentioned here, we do expect it to be sometimes less challenging for the highest rated participants now. The range of "Rated for All" contests has increased, and so there will be some contests where IGMs solve all problems without too much sweat.

    We just feel that there are enough users in the 7-star range as well, who find these challenging enough to have it be rated for all. For eg. in yesterday's contest, there were 25 7-star coders, and 8 of them solved all 7 problems. But 10 couldn't solve 1 problem and 7 couldn't AC 2 problems. Given that we definitely cannot have contests every month where the number of AKs is 1 or 2, we feel that having occasional easier Rated for All contests is a better compromise than having much fewer Rated for All contests.

    Maybe from the next time, we'll also add something along the lines of "We expect it to challenge IGMs" or "We expect IGMs to AK the problem set" in the intro blog. Would that help?