Google Code Jam 2021 Qualification Round Solutions & Live Commentary

Поділитися
Вставка
  • Опубліковано 31 тра 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.

КОМЕНТАРІ • 153

  • @Errichto
    @Errichto  3 роки тому +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 3 роки тому

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

    • @Errichto
      @Errichto  3 роки тому +1

      @@07_akashsudan71 school and math olympiad :|

    • @07_akashsudan71
      @07_akashsudan71 3 роки тому

      @@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  3 роки тому

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

    • @07_akashsudan71
      @07_akashsudan71 3 роки тому

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

  • @qster
    @qster 3 роки тому +70

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

  • @requiem418
    @requiem418 3 роки тому +28

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

    • @satyampandey5584
      @satyampandey5584 3 роки тому

      yeah I also took many hours to solve that one.

  • @simon.p
    @simon.p 3 роки тому

    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!

  • @ThommyTheThird
    @ThommyTheThird 3 роки тому

    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 3 роки тому +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.

  • @lfepped6474
    @lfepped6474 3 роки тому +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❤️

  • @SuperOazy
    @SuperOazy 3 роки тому +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 2 роки тому +1

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

  • @napoleonbonaparte5972
    @napoleonbonaparte5972 3 роки тому +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  3 роки тому +8

      I'm hoping for that too!

  • @aadityaupadhyay6264
    @aadityaupadhyay6264 3 роки тому +63

    Only legends know it's reuploaded.

    • @Manu-wb2uv
      @Manu-wb2uv 3 роки тому +2

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

    • @Errichto
      @Errichto  3 роки тому +4

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

    • @Manu-wb2uv
      @Manu-wb2uv 3 роки тому

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

    • @meenameiss
      @meenameiss 3 роки тому +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 3 роки тому

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

  • @johngamal2
    @johngamal2 3 роки тому +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

  • @KleptomaniacJames
    @KleptomaniacJames 3 роки тому +21

    theres something about the sound of that keyboard

  • @namanbir
    @namanbir 3 роки тому

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

  • @hb4665
    @hb4665 3 роки тому +1

    Thanks it helps and motivates a lot..

  • @warriorhuskar998
    @warriorhuskar998 3 роки тому

    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  3 роки тому

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

  • @AkashKumar-im2zy
    @AkashKumar-im2zy 3 роки тому

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

    • @Errichto
      @Errichto  3 роки тому +1

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

    • @imranif3899
      @imranif3899 3 роки тому

      @@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...

  • @CodingInterviewPrep
    @CodingInterviewPrep 3 роки тому +23

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

  • @VibhorMittal
    @VibhorMittal 3 роки тому +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. 😊

  • @Manu-wb2uv
    @Manu-wb2uv 3 роки тому +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 3 роки тому +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 3 роки тому +1

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

    • @prakash_77
      @prakash_77 3 роки тому

      @@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 3 роки тому

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

    • @abhishek.rathore
      @abhishek.rathore 3 роки тому +1

      @@prakash_77 yea same

  • @awadonalcien9487
    @awadonalcien9487 3 роки тому

    Thanks Errichto ❤️

  • @iitnakanpur..
    @iitnakanpur.. 3 роки тому +4

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

    • @Errichto
      @Errichto  3 роки тому +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].

  • @ShaitanBoLtZmAn
    @ShaitanBoLtZmAn 3 роки тому

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

  • @kongzilla2897
    @kongzilla2897 3 роки тому +1

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

  • @j.franciscox3318
    @j.franciscox3318 3 роки тому +7

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

    • @Errichto
      @Errichto  3 роки тому +4

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

  • @kellyguzman7679
    @kellyguzman7679 3 роки тому

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

  • @arunvijay4252
    @arunvijay4252 3 роки тому

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

  • @treyquattro
    @treyquattro 3 роки тому +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 3 роки тому

      I think you need to download geany themes seperately.

    • @treyquattro
      @treyquattro 3 роки тому

      @@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  3 роки тому +3

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

    • @treyquattro
      @treyquattro 3 роки тому

      @@Errichto thanks!

  • @Neeecu
    @Neeecu 3 роки тому

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

    • @Errichto
      @Errichto  3 роки тому +1

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

    • @Neeecu
      @Neeecu 3 роки тому

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

  • @josealejandrovaroncarreno1692
    @josealejandrovaroncarreno1692 3 роки тому +1

    por fin otras olimpiadas de programacion

  • @Warrior.-
    @Warrior.- 3 роки тому +2

    I hope you get the first place 🥇

  • @rajpaltanwale8291
    @rajpaltanwale8291 3 роки тому

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

    • @Errichto
      @Errichto  3 роки тому

      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

  • @jvthunder6548
    @jvthunder6548 3 роки тому +2

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

  • @devangsrivastava6736
    @devangsrivastava6736 3 роки тому

    That median sort was real beast
    ...

  • @rewatkedari
    @rewatkedari 3 роки тому

    Brother round 1 is also live ??

  • @achismanbanerjee8385
    @achismanbanerjee8385 2 роки тому

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

    • @limakbear7029
      @limakbear7029 2 роки тому

      Logitech keyboard, u can read his FAQ

  • @dragotech6024
    @dragotech6024 3 роки тому

    can you create link for your codes???

  • @GGxEpsilon
    @GGxEpsilon 3 роки тому +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  3 роки тому +16

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

    • @GGxEpsilon
      @GGxEpsilon 3 роки тому +2

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

  • @geeksview2282
    @geeksview2282 3 роки тому +2

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

    • @Errichto
      @Errichto  3 роки тому +3

      See my "how to start Competitive Programming" video ua-cam.com/video/xAeiXy8-9Y8/v-deo.html

    • @geeksview2282
      @geeksview2282 3 роки тому

      @@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 3 роки тому

      @@Errichto A lot has changed till then.

  • @k900421
    @k900421 3 роки тому +1

    Unbelievable speed...

  • @lucass6436
    @lucass6436 3 роки тому

    can someone explain the prompt....

  • @shivangtiwari8694
    @shivangtiwari8694 3 роки тому +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 3 роки тому

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

    • @Errichto
      @Errichto  3 роки тому +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 3 роки тому

      @@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 3 роки тому

      @@lfepped6474 I got all accepted though

    • @lfepped6474
      @lfepped6474 3 роки тому

      @@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

  • @spy8514
    @spy8514 3 роки тому +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 3 роки тому +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 3 роки тому +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 3 роки тому +2

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

    • @Errichto
      @Errichto  3 роки тому +10

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

    • @spy8514
      @spy8514 3 роки тому

      @@Errichto That must be it! Hahaha

  • @jakubwasilewski9518
    @jakubwasilewski9518 Рік тому

    Fajny materiał

  • @cbjueueiwyru7472
    @cbjueueiwyru7472 3 роки тому +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  3 роки тому +4

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

    • @shritishaw7510
      @shritishaw7510 3 роки тому +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.

  • @krishnapandya9227
    @krishnapandya9227 3 роки тому +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  3 роки тому +3

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

  • @sabbirhasan2852
    @sabbirhasan2852 3 роки тому

    Which ide did Errichto used in this vedio?

    • @pameng5235
      @pameng5235 3 роки тому

      Hi in one of the videos he said it is geany

  • @vaibhavaggarwal6808
    @vaibhavaggarwal6808 3 роки тому

    thanks a lot😃

  • @sarthak_dms
    @sarthak_dms 2 роки тому

    Can someone tell me which Linux he is using??

  • @madhurjoshi4113
    @madhurjoshi4113 3 роки тому +1

    Which keyboard brother?

    • @Errichto
      @Errichto  3 роки тому

      Logitech UltraX Premium

  • @sdeBack1
    @sdeBack1 3 роки тому

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

    • @Errichto
      @Errichto  3 роки тому +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].

  • @roshatron
    @roshatron 3 роки тому

    Why does he use scanf and printf in cpp

  • @thetester8371
    @thetester8371 3 роки тому +1

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

    • @Errichto
      @Errichto  3 роки тому +2

      It's more common in ICPC and GCJ.

    • @thetester8371
      @thetester8371 3 роки тому +1

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

  • @AyushRaj-pm1dz
    @AyushRaj-pm1dz 2 роки тому

    what kind of sorcery is this !!!🤯🤯

  • @arinroday302
    @arinroday302 3 роки тому

    Why don't I see him on the leaderboard

  • @jcm5046
    @jcm5046 3 роки тому

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

  • @damvrcvsh176
    @damvrcvsh176 3 роки тому

    terminals??

  • @matheuscosta5330
    @matheuscosta5330 3 роки тому +1

    Finally

  • @Gagan-lz2fu
    @Gagan-lz2fu 3 роки тому

    🤘

  • @stepb795
    @stepb795 3 роки тому

    nice sub indo thans sir!

  • @DevashishDasBioinfo
    @DevashishDasBioinfo 3 роки тому

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

    • @Errichto
      @Errichto  3 роки тому +4

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

    • @DevashishDasBioinfo
      @DevashishDasBioinfo 3 роки тому

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

  • @taresy6789pp
    @taresy6789pp 3 роки тому

    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")

  • @iloveiit7040
    @iloveiit7040 3 роки тому +3

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

  • @Kh05
    @Kh05 3 роки тому

    👍🏻

  • @luisnegrao5951
    @luisnegrao5951 2 роки тому

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

  • @user-yi1qv1ww8u
    @user-yi1qv1ww8u 3 роки тому

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

  • @josephwong2832
    @josephwong2832 2 роки тому

    cool

  • @sanskarjain7986
    @sanskarjain7986 3 роки тому +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  3 роки тому +3

      Or you're better than you think :)

  • @LeandroCoutinho
    @LeandroCoutinho 3 роки тому +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  3 роки тому +1

      Sum of arithmetic series.

  • @gauravkumeriya376
    @gauravkumeriya376 3 роки тому

    Niceeeaaa

  • @hggi4497
    @hggi4497 3 роки тому

    Hi teacher

  • @David-lu6np
    @David-lu6np 3 роки тому

    Can you elaborate Q.1 plzz

    • @Errichto
      @Errichto  3 роки тому

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

    • @David-lu6np
      @David-lu6np 3 роки тому

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

  • @jeetenderkakkar7570
    @jeetenderkakkar7570 3 роки тому

    Passbook

  • @boco6969
    @boco6969 3 роки тому +1

    Canadian guy finished this in less than an hr jesus

  • @gaijindavid_san
    @gaijindavid_san 3 роки тому +6

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

    • @Errichto
      @Errichto  3 роки тому +4

      I will take third place, thanks.

  • @Manu-wb2uv
    @Manu-wb2uv 3 роки тому

    Second!