Google Code Jam 2021 Qualification Round Solutions & Live Commentary

Sdílet
Vložit
  • čas přidán 3. 06. 2024
  • My screencast and commentary of GCJ 2021 Qualification Round. Problems and leaderboard: codingcompetitions.withgoogle...
    0:00 A. Reversort
    3:37 C. Reversort Engineering
    12:40 B. Moons and umbrellas
    17:55 D. Median Sort
    1:26:18 E. Cheating Detection
    1:55:37 Results, Summary
    Coding live streams - / errichto
    FAQ - github.com/Errichto/youtube/w...
    Subscribe for more educational videos on algorithms, coding interviews and competitive programming.

Komentáře • 153

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

    0:00​ A - Reversort
    3:37​ C - Reversort Engineering
    12:40​ B - Moons and umbrellas
    17:55​ D - Median Sort
    1:26:18​ E - Cheating Detection
    1:55:37​ Results, Summary

    • @07_akashsudan71
      @07_akashsudan71 Před 3 lety

      Can you tell the resources through which you mastered math for competitive programming.

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

      @@07_akashsudan71 school and math olympiad :|

    • @07_akashsudan71
      @07_akashsudan71 Před 3 lety

      @@Errichto can you recommend any book for math. I saw you solving a question that had some concept related to group theory and i couldn't find any relevant material related to group theory in any book. I am from india and math taught here at school level is not good. So can please recommend any good material.

    • @Errichto
      @Errichto  Před 3 lety

      I never went through any math book in English.
      @Code NCode has a series of videos on number theory czcams.com/play/PL2q4fbVm1Ik4liHX78IRslXzUr8z5QxsG.html

    • @07_akashsudan71
      @07_akashsudan71 Před 3 lety

      @@Errichto thanks man. By the way a big fan of you.

  • @qster
    @qster Před 3 lety +70

    I understand nothing of this but still find it therapeutic to watch for some reason :D

  • @requiem418
    @requiem418 Před 3 lety +28

    Reversort engineering took me hours to solve, he did it inside 10 minutes. Insane.

  • @simon.p
    @simon.p Před 3 lety

    Thanks for the video! I personally enjoyed it way more than other videos where you code in like 10 minutes and win the contest. It was great to be able to see how you actually think when you occasionally get stuck :) Hope to see more videos like this in the future!

  • @lfepped6474
    @lfepped6474 Před 3 lety +10

    Errichto saying "or maybe i am not good enough to solve this problem"
    le me: I am not even qualified to hear this:))
    p.s: you are so down to the earth and bmost helpful person of the whole community❤️

  • @ThommyTheThird
    @ThommyTheThird Před 3 lety

    Impressive as always. Your solution to the CJJC mural problem was so quick and elegant... I'd have to doublecheck and compare it with mine, because I think I wrote at least 3x as much code and made it more complicated than it needed to be...
    Good job :)

  • @AnuragKumar-tn5gd
    @AnuragKumar-tn5gd Před 3 lety +5

    I feel sorry about your rank Errichto :(, you are one of the best programmer!! And I follow you regularly for programming videos. Keep good work bro, next round 1.

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

    Thanks a lot for sharing this. I have been always wondering how these top ranked people solve the problems this fast!

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

    It's really helpful to see you solve the problem, thanks a lot!

  • @napoleonbonaparte5972
    @napoleonbonaparte5972 Před 3 lety +5

    All the best for the future Errichto!
    PS - Here's to hoping that you might be the one to break tourist's streak by winning this year :)

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

      I'm hoping for that too!

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

    I don't know if you covered this in any video, but I'd love if you show us the keyboard shortcuts you use or how you deal with your coding environment in general

  • @aadityaupadhyay6264
    @aadityaupadhyay6264 Před 3 lety +63

    Only legends know it's reuploaded.

    • @Manu-wb2uv
      @Manu-wb2uv Před 3 lety +2

      Haha. What was the title? Place 6......

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

      @@Manu-wb2uv (6th place) Google Code Jam 2021 Qualification Round Screencast

    • @Manu-wb2uv
      @Manu-wb2uv Před 3 lety

      ​@@Errichto well you were very close indeed. The DP problem was a little tricky.

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

      @@Manu-wb2uv Started competitive programming because of Kamil and I got that one point correct. (I didn't manage to realize D required log3 and didn't do E at all but still pretty proud)

    • @Manu-wb2uv
      @Manu-wb2uv Před 3 lety

      @@meenameiss good job. That means I'll see you in the next round

  • @namanbir
    @namanbir Před 3 lety

    Hey. Are you gonna do a live stream for the Round 1?

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

    Thanks it helps and motivates a lot..

  • @KleptomaniacJames
    @KleptomaniacJames Před 3 lety +21

    theres something about the sound of that keyboard

  • @warriorhuskar998
    @warriorhuskar998 Před 3 lety

    D can be approached linearly by tenary search for each index from 3, total number of queries used for each case is sum of ceil(log3(x)) where x from 3 to 50 ~ 160

    • @Errichto
      @Errichto  Před 3 lety

      O(N*log3(N)) is not linear.
      But yeah, the intended solution was indeed ternary search, which means the logarithm of base 3.

  • @awadonalcien9487
    @awadonalcien9487 Před 3 lety

    Thanks Errichto ❤️

  • @CodingInterviewPrep
    @CodingInterviewPrep Před 3 lety +23

    *Google code jam qualifiers exists for 40 minutes
    *Le Errichto: Lets do it in 20 minutes or 30 minutes.

  • @j.franciscox3318
    @j.franciscox3318 Před 3 lety +7

    Keyboard sounds great, mind sharing the brand and model? Thank you.

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

      it's an old model - Logitech UltraX Premium. You would need to hunt a used one in good shape.

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

    Why am I getting previous video as private ? Btw nice Round ...Was able to solve 3 :)

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

    I've been following Errichto's brilliance for some time now, and I finally decided to give Geany a try: how do I get it to pick up KDE plasma theme settings? The app stays light even though I can change the editing & terminal windows to a dark mode (downloaded configs from github). Kamil, you're an inspiration!

    • @organic2976
      @organic2976 Před 3 lety

      I think you need to download geany themes seperately.

    • @treyquattro
      @treyquattro Před 3 lety

      @@organic2976 thanks. I have dark themes for the editing window, e.g., but I want the entire app to be dark mode windows. Haven't found out how to do that yet, but I believe it's possible.

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

      You need to download the monokai theme.
      Read more here github.com/Errichto/youtube/wiki/Linux-&-Geany-Setup

    • @treyquattro
      @treyquattro Před 3 lety

      @@Errichto thanks!

  • @rajpaltanwale8291
    @rajpaltanwale8291 Před 3 lety

    Can you tell me which digital writing pad do you use? And does it help in programming?

    • @Errichto
      @Errichto  Před 3 lety

      You mean a drawing tablet? Something from Wacom. It doesn't help in programming though.
      Read more about my hardware here github.com/Errichto/youtube/wiki/FAQ#hardware

  • @Manu-wb2uv
    @Manu-wb2uv Před 3 lety +12

    At the third problem with the Reverse Sort you just leave me breathless. Where do you get those formulas from ? What's the thought process behind ?

    • @abhishek.rathore
      @abhishek.rathore Před 3 lety +6

      Same dude, I spent hours trying to find some pattern in the output and all. I brute forced the first test for 7 points but the actual solution I still dont understand.

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

      you can derive the soultion of 3rd problem from 1st just think in reverse manner

    • @prakash_77
      @prakash_77 Před 3 lety

      @@abhishek.rathore Same here dude. I derived the conditions for the IMPOSSIBLE test cases but couldn't figure how to solve for test set 2.

    • @prakash_77
      @prakash_77 Před 3 lety

      Reverse Sort formula is pretty common in C++ (in Competitive Programming). STL comes in handy in CP.

    • @abhishek.rathore
      @abhishek.rathore Před 3 lety +1

      @@prakash_77 yea same

  • @AkashKumar-im2zy
    @AkashKumar-im2zy Před 3 lety

    In Problem C, please let me know what function on line 37 is doing? how did you arrive at "c

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

      It's the sum of numbers from pref+1 to N.

    • @imranif3899
      @imranif3899 Před 3 lety

      @@Errichto Oh, that explains it. But why did you check the sum of suffixes here? also, isn't that n*(n+1)/2 - pref*(pref+1)/2 ?
      Sorry if I have misunderstood...

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

    These probability problems are beautiful, hope I get good at them. Was able to solve first 4. Also why no future Kamil?

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

      Because the current Kamil was talking while solving problems ;)
      There is future Kamil if I past Kamil doesn't talk.

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

      @@Errichto sad to see you fail B though, you had a really good rank before that.

  • @ShaitanBoLtZmAn
    @ShaitanBoLtZmAn Před 3 lety

    Sir , from where you learned programming ,I know and understand python but not able to create codes and solve problems like these

  • @iitnakanpur..
    @iitnakanpur.. Před 3 lety +4

    You got WA on the last test case of 2nd questions. why is it?

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

      It was a mistake to initialize dp values as 0. My program thinks it's allowed to get score from s[-1] to s[0].

  • @Neeecu
    @Neeecu Před 3 lety

    What board are you using for writing? I see it's OneNote but there is no official OneNote app on Ubuntu

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

      Ubuntu is just a virtual machine so I can still run OneNote from the main OS, which is Windows.

    • @Neeecu
      @Neeecu Před 3 lety

      @@Errichto Oh ok great, makes sense now, thanks!

  • @josealejandrovaroncarreno1692

    por fin otras olimpiadas de programacion

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

    It took me 10 hours+ to solve first 3 problems,
    3rd problem only passed the test case 1. Was excited enough to get 31 points, just enough to qualify for next round.
    I wrote mostly brute force solutions to all 3 problems.
    Guess, back to drawing board now.
    Glad to see you took atleast 10 mins for problem 3. 😊

  • @achismanbanerjee8385
    @achismanbanerjee8385 Před 2 lety

    Excuse me sir, but which company Keyboard do you use?? Tempted to ask this question :D

  • @arunvijay4252
    @arunvijay4252 Před 3 lety

    I have a doubt on the code above it what is the use of it bro please say

  • @rewatkedari
    @rewatkedari Před 3 lety

    Brother round 1 is also live ??

  • @devangsrivastava6736
    @devangsrivastava6736 Před 3 lety

    That median sort was real beast
    ...

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

    This guy is good at this.
    Please upload a beginner's guide.
    Really wanted to get into this.

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

      See my "how to start Competitive Programming" video czcams.com/video/xAeiXy8-9Y8/video.html

    • @geeksview2282
      @geeksview2282 Před 3 lety

      @@Errichto I have already watched that video you uploaded an year ago.
      I just wanted you to upload a beginner's guide 2021.

    • @geeksview2282
      @geeksview2282 Před 3 lety

      @@Errichto A lot has changed till then.

  • @Warrior.-
    @Warrior.- Před 3 lety +2

    I hope you get the first place 🥇

  • @dragotech6024
    @dragotech6024 Před 3 lety

    can you create link for your codes???

  • @jakubwasilewski9518
    @jakubwasilewski9518 Před rokem

    Fajny materiał

  • @vaibhavaggarwal6808
    @vaibhavaggarwal6808 Před 3 lety

    thanks a lot😃

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

    Wow live commentary and still getting a high rank ure so cool, meanwhile me getting rank 4600 :(

  • @kellyguzman7679
    @kellyguzman7679 Před 3 lety

    I also qualified this time. See you in round 1A

  • @cbjueueiwyru7472
    @cbjueueiwyru7472 Před 3 lety +5

    The codejam problems are worded so overcomplicated. It took me so long just to understand what the questions were asking. I barely slid through qualification round with minimum points.

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

      I guess it's also a skill to read statements fast and skip unnecessary parts.

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

      @@Errichto Actually, it takes time and experience to come with the skills you got. Investing time in them at the beginning of CP journey will come out to be fruitful later.

  • @sabbirhasan2852
    @sabbirhasan2852 Před 3 lety

    Which ide did Errichto used in this vedio?

    • @pameng5235
      @pameng5235 Před 3 lety

      Hi in one of the videos he said it is geany

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

    Unbelievable speed...

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

    For median sort I tried to insert every element into the current(sorted) array. I found out the position of the new element using ternary search and just inserted it at that position. Using the median query you can easily determine which third of this array the new element should go to.

    • @lfepped6474
      @lfepped6474 Před 3 lety

      dude.i did the sameeee...it was one of the fastest solves i made apart from the no1..xD

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

      Yeah, many people did O(N*log3(N)) with ternary search. I don't think it was expected to use O(N*log2(N)) merge sort with a good constant factor.

    • @lfepped6474
      @lfepped6474 Před 3 lety

      @@Errichto yep..even tho I solved it in less time , I got TLE in the hidden test case :'( so your solve was way optimized than mine :))

    • @shivangtiwari8694
      @shivangtiwari8694 Před 3 lety

      @@lfepped6474 I got all accepted though

    • @lfepped6474
      @lfepped6474 Před 3 lety

      @@shivangtiwari8694 i used cout and cin ..can that be the reason of TLE? i saw on codeforces that people suggest to use scanf and printf for interactive problems

  • @lucass6436
    @lucass6436 Před 3 lety

    can someone explain the prompt....

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

    Which keyboard brother?

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

    I thought that there are only 4 problems in Codejam😂. I was counting total and total didn't match with 101 points still I thought that the remaining points are due to some more hidden test cases. Lol. (btw this was my first-time participation. I will be cautious next time)Thanks for letting me know there were total 5 problems😁

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

      Their UI is pretty bad recently, it's easy to miss the last problem :(

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

    It is unfortunate that you missed the extra in problem B but can you somehow explain how your code did not work? What did you missed?

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

      He initialised last_c and last_j = 0 which is wrong. The simplest counter case is just a string of length 1, “?”. The answer should be 0 but his code will give the answer as minimum of (x, y, 0) which will be wrong if either of x or y is negative. This happens because assuming last_c and last_j to be 0 for empty string is wrong.

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

      #include
      using namespace std;
      #define int long long
      const int INF = 1e18L + 5;
      void solve() {
      int x, y;
      cin >> x >> y;
      string s;
      cin >> s;
      int n = (int) s.length();
      if(n == 1) {
      cout 0 ? min(pv_j, pv_c + x) : 0);
      }
      pv_c = cur_c, pv_j = cur_j;
      }
      cout t;
      for (int tt = 1; tt

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

      I have made the necessary changes to the code. Now it passes all the test case.

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

      Or maybe I just wanted to get a nice score of 100 points out of 101 :D

    • @spy8514
      @spy8514 Před 3 lety

      @@Errichto That must be it! Hahaha

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

    Finally

  • @sdeBack1
    @sdeBack1 Před 3 lety

    What you missed in problem B for hidden test cases ???

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

      It was a mistake to initialize dp values as 0. My program thinks it's allowed to get score from s[-1] to s[0].

  • @Gagan-lz2fu
    @Gagan-lz2fu Před 3 lety

    🤘

  • @sarthak_dms
    @sarthak_dms Před 2 lety

    Can someone tell me which Linux he is using??

  • @roshatron
    @roshatron Před 3 lety

    Why does he use scanf and printf in cpp

  • @arinroday302
    @arinroday302 Před 3 lety

    Why don't I see him on the leaderboard

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

    Problem E was so weird. Never seen something like that on Codeforces or atcoder. The rest of the problems were cool.

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

      It's more common in ICPC and GCJ.

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

      @@Errichto Ok......time to expand my training horizon then.

  • @Kh05
    @Kh05 Před 3 lety

    👍🏻

  • @stepb795
    @stepb795 Před 3 lety

    nice sub indo thans sir!

  • @damvrcvsh176
    @damvrcvsh176 Před 3 lety

    terminals??

  • @gauravkumeriya376
    @gauravkumeriya376 Před 3 lety

    Niceeeaaa

  • @AyushRaj-pm1dz
    @AyushRaj-pm1dz Před 2 lety

    what kind of sorcery is this !!!🤯🤯

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

    I have qualified in it I am happy hope I will win the code jam title this year 😁😁

  • @jcm5046
    @jcm5046 Před 3 lety

    Haha seriously. Just how did you guys get so good at programming (problem solving)

  • @josephwong2832
    @josephwong2832 Před 2 lety

    cool

  • @DevashishDasBioinfo
    @DevashishDasBioinfo Před 3 lety

    Sorry! :( Your rank slipped from 7 to 437 because of "Moons and Umbrella". We all support you!

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

      100/101 is still a good score, I think :)

    • @DevashishDasBioinfo
      @DevashishDasBioinfo Před 3 lety

      @@Errichto Totally agreed! Best of luck for rest of the competition!

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

    Very nice Errichto!!! Thanks for sharing your thoughts!
    Amazing! :D
    It's nice that you got the formula: n * (n + 1) / 2 - 1
    for problem C.
    I need to learn how to find those ...

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

      Sum of arithmetic series.

  • @David-lu6np
    @David-lu6np Před 3 lety

    Can you elaborate Q.1 plzz

    • @Errichto
      @Errichto  Před 3 lety

      Which part? That problem just requires direct implementation of whatever is written in the statement.

    • @David-lu6np
      @David-lu6np Před 3 lety

      @@Errichto yes I tried to solve it with that but I wasn't able to pass the test cases

  • @luisnegrao5951
    @luisnegrao5951 Před 2 lety

    Theres an algo named Median of 5 medians that should help on the problem

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

    The first 3 Ques were easy to understand but it was codejam so I was like this couldn`t be this easy. I definitely read it wrong or I am missing something.

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

      Or you're better than you think :)

  • @taresy6789pp
    @taresy6789pp Před 3 lety

    you are genius i am struggling to understand this
    import math
    import sys
    for line in sys.stdin:
    line.strip()
    n=int(line.strip())
    for i in range(1,n+1):
    if i % 3==0: and i % 5==0:
    print("FizzBuzz")
    elif i % 3==0:
    print("Fizz")
    elif i % 5==0:
    print("Buzz")
    else:
    print(i)
    def Books(l):
    for j in range(1,10**5):
    l=([i,i+1,i+2,i+3,i+4,i+5,i+6,i+7])
    print(len(l))
    if l[0]==i:
    print(l[0])
    return bool("True")
    else:
    return bool("False")

  • @user-yi1qv1ww8u
    @user-yi1qv1ww8u Před 3 lety

    I'm glad you're not my teacher, because I am barely understand what were you talking about.

  • @jeetenderkakkar7570
    @jeetenderkakkar7570 Před 3 lety

    Passbook

  • @hggi4497
    @hggi4497 Před 3 lety

    Hi teacher

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

    World's greatest programmer, after tourist and me; :D ;)

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

      I will take third place, thanks.

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

    Canadian guy finished this in less than an hr jesus

  • @Manu-wb2uv
    @Manu-wb2uv Před 3 lety

    Second!