Algo Talk with SecondThread: Parade

Sdílet
Vložit
  • čas přidán 3. 06. 2024
  • I'm joined by David (SecondThread) to discuss my problem Parade, where you can choose a subset of input to make your task easier. Check out a beautiful IOI problem Joining Points on his channel • Algo Talk with Erricht...
    Full English statement of Parade: github.com/Errichto/youtube/b...
    Submit in Polish judge: szkopul.edu.pl/problemset/pro...
    Subscribe for more educational videos on algorithms, coding interviews and competitive programming.
    - Watch my live streams on Twitch or my 2nd YT channel / errichto & / errichto2
    - Frequently Asked Questions: github.com/Errichto/youtube/w...

Komentáře • 60

  • @Errichto
    @Errichto  Před 3 lety +85

    Interesting fact: as organizers, we were afraid of some people squeezing good TSP heuristics and completely missing the point of the problem. So our checker was a complicated state-of-the-art solution for TSP. There were tens of tests and you would get WA if for any test the checker found a cycle shorter than yours (for your K chosen points). This already makes it hard enough to pass the problem with any heuristics. What if I tell you that the checker also had bigger ML and TL than participants' submissions. And the checker used multi-threading! We used threads (numbered from 1 to 8) and the first one was the master thread just to distribute the work. Any mistake was most often caught by the first of the remaining threads. Long story short, Second Thread made sure that every submission was indeed optimal. So please subscribe to him czcams.com/channels/XbCohpE9IoVQUD2Ifg1d1g.html

    • @so7am96
      @so7am96 Před 3 lety +6

      I see what u did there :"D
      nice episode btw, really enjoyed the problem and the awesome solution!!

    • @softwaredeveloper4304
      @softwaredeveloper4304 Před 3 lety

      Awesome problem I can hear you think. Question? Why not find the 4 points that are furthest away from each other, then use a line to segment them, and then find the variance of the distance from that line and using that result, while retaining the distance between each point on the line, resulting in an the area leading us to the most optimal path? Would that work? If it does then the complexity of the algorithm would most likely be from n points O( m ) where m is the distance from the line and the distance between the points on that line. I'm probably totally off.

  • @AlgosWithKartik
    @AlgosWithKartik Před 3 lety +20

    The summary was very helpful!

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd Před 3 lety +47

    Errichto + SecondThred = Main Thread( Coding )

    • @Errichto
      @Errichto  Před 3 lety +54

      Errichto + SecondThread = Errichto2
      ?

    • @ChandraShekhar-by3cd
      @ChandraShekhar-by3cd Před 3 lety +6

      @@Errichto There is no limit to Creativity!!! You're so creative.
      Now we've an equation Errichto + SecondThread = Errichto2
      hence LHS == RHS Proved! Math Wins!

    • @OptimisticForce
      @OptimisticForce Před 3 lety

      @@Errichto You smart for a reason.

  • @anuraggupta3557
    @anuraggupta3557 Před 3 lety +3

    Thanks for posting this. I learned a lot. Keep up the good work.

  • @naklecha
    @naklecha Před 3 lety +1

    I didn't know I needed this and now I need more.

  • @dhiresh5980
    @dhiresh5980 Před 3 lety +3

    The podcast I didn't know I was searching for

  • @darshpatel8385
    @darshpatel8385 Před 3 lety +1

    Collab for which I've been waiting since forever.

  • @shivamjalotra7919
    @shivamjalotra7919 Před 3 lety +3

    Finally SecondThread is here.

  • @x0cx102
    @x0cx102 Před 2 lety +1

    21:45 wow really nice use of erdos-szekeres there to get sqrt(N) increasing or sqrt(N) decreasing subsequence

  • @shubh_chaudhri
    @shubh_chaudhri Před 3 lety

    Was waiting for this!!!!🔥

  • @genuineprofile6400
    @genuineprofile6400 Před 3 lety

    This is amazing.

  • @jan1495
    @jan1495 Před 3 lety +37

    Last time I came this early, my GF broke up with me.

  • @OzdyTube
    @OzdyTube Před 3 lety +4

    When do you talk about the proof that the bitonic TSP is optimal in 2D LIS(LDS) points?

    • @Errichto
      @Errichto  Před 3 lety

      The proof for a path is around 19:00. Then for a cycle we just say that cycle consists of two parts, each going from bottom-left to top-right point. Or maybe I misunderstood your question?

  • @MrDalgerokChannel
    @MrDalgerokChannel Před 3 lety +1

    Which K points you choose from the set of LIS points (size of set is greater than K)?
    From that dp you end when i or j is equal to K, but we assume that we start from the first point of the set of LIS points, why we can’t start from another one?

    • @Errichto
      @Errichto  Před 3 lety

      Any K of those points, can be first K of them. It's only important that chosen points form a monotonic chain. I don't know what dp you want to do after starting not from the first point.

    • @MrDalgerokChannel
      @MrDalgerokChannel Před 3 lety

      @@Errichto what if we have 4 points, K=3 and first point is far away from the second point and points 2,3,4 are close to each other? Then you better pick points 2,3,4.

    • @Errichto
      @Errichto  Před 3 lety +1

      @@MrDalgerokChannel You don't need to choose K points in optimal way. The task says: choose any K points, forget about the other N-K points, then do TSP optimally.

  • @janix4000
    @janix4000 Před 3 lety

    What type of drawing software do you use?

  • @Nunocesarsa
    @Nunocesarsa Před 3 lety

    Im at 11:00 so idk the solution. Could it be using angles between points like the convex hull? and if you already visited the point then you go for the next. Lets see!

  • @nachiketkanore
    @nachiketkanore Před 3 lety

    Make more AlgoTalks @Errichto

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd Před 3 lety +1

    @Errichto What is dp[m | 1

    • @Errichto
      @Errichto  Před 3 lety +2

      It's ok if you aren't familiar with bitmask DP, just skip those few minutes. The actual solution doesn't use that.

    • @ChandraShekhar-by3cd
      @ChandraShekhar-by3cd Před 3 lety +1

      @@Errichto Sure Thanks Errichto. I am your constant follower of all your videos and codeforces blog. You' re the best! Always inspired by the way you code!

  • @arjanbal3972
    @arjanbal3972 Před 3 lety +1

    I'm curious, how does the judge know if the output is not the solution to TSP? Won't the judge be able to solve TSP if it can always find a shorter path for incorrect answers?

    • @Errichto
      @Errichto  Před 3 lety +3

      Read the pinned comment. In short, the checker tries to find a better solution with good heuristics.

    • @welldone3806
      @welldone3806 Před 3 lety

      @@Errichto yup

  • @dhananjaysonawane1996
    @dhananjaysonawane1996 Před 3 lety +2

    @21:40 How can we say that LIS or LDS will have k > √N?

    • @Errichto
      @Errichto  Před 3 lety +1

      we get back to this fact at 32:45

    • @techwithwhiteboard3483
      @techwithwhiteboard3483 Před 3 lety

      u can use erdos skizeres theorem. given n^2 + 1 points u can always find either an increasing sequence of length n or a decresing sequence of atleast length n

    • @dhananjaysonawane1996
      @dhananjaysonawane1996 Před 3 lety

      @@techwithwhiteboard3483 Thanks for sharing!

  • @welldone3806
    @welldone3806 Před 3 lety +1

    Errichto + second thread=red thread

  • @kubakakauko
    @kubakakauko Před 3 lety +1

    Where do i learn the basics of the math for algorithm programming

  • @AlexSav
    @AlexSav Před 3 lety

    How did the organizers check that some other solution was not correct?

    • @welldone3806
      @welldone3806 Před 3 lety

      If judge can find minimum than the sol it means sol is incorrect

    • @Errichto
      @Errichto  Před 3 lety

      See the pinned comment

  • @pratyushmisra2516
    @pratyushmisra2516 Před 3 lety +1

    Hi Errichto, Could u please make a video on counter examples for Greedy algos or sort of a mental models for Greedy counter egs... it will help differentiate between DP and Greedy.....PLEASE UPVOTE THIS COMMENT IF U GUYS AGREE!!!!!

  • @manas_singh
    @manas_singh Před 3 lety +9

    There is so much of red color in one video, CZcams hq will have a server meltdown

  • @kathilroyal3554
    @kathilroyal3554 Před 3 lety

    Jestem polakiem i już myślałem, że znajdę coś ciekawego po polsku, a tutaj cały kanał po angielsku xd

  • @dovyraj1272
    @dovyraj1272 Před 3 lety +13

    so the cold war is over.

  • @raghugore3990
    @raghugore3990 Před 3 lety

    Can u please provide solution and explanation for the below :
    Write a program to find Largest 4 digits Prime Number whose Sum of Digits is also Prime.
    1.Prime Number is any number that is divisible only by 1 and itself. Examples are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31,........
    2.Sum of Digits means sum of all the digits in that number. Example is number is 1234 then the sum of digits is 1+2+3+4=10

  • @raghavbansal4403
    @raghavbansal4403 Před 3 lety +1

    SecondThread looks like radewoosh

  • @aladeenaladeen6274
    @aladeenaladeen6274 Před 3 lety

    second

  • @subhadipadhikary270
    @subhadipadhikary270 Před 3 lety +1

    I challenge you to make mini metro solver

    • @Errichto
      @Errichto  Před 3 lety

      what is metro?

    • @subhadipadhikary270
      @subhadipadhikary270 Před 3 lety +1

      @@Errichto"mini metro" is an android game
      simple but quite interesting.I was eager to make an algo to solve that but i have no idea on ml so i left if.

  • @iamcttaburn3838
    @iamcttaburn3838 Před 3 lety

    David looks like a character from subway surfers

  • @nomnom1378
    @nomnom1378 Před 3 lety

    please help me my fb account was hacked, can you help restore my fb account

  • @baxi9227
    @baxi9227 Před 3 lety +3

    this was made for high schoolers to solve.