darkshadows's blog

By darkshadows, history, 6 years ago, In English

Throughout the year, Google Code Jam hosts online Kickstart rounds to give participants the opportunity to develop their coding skills, get acquainted with Code Jam’s competition arena, and get a glimpse into the programming skills needed for a technical career at Google.

Each Kickstart round gives participants 3 hours to solve challenging, algorithmic problems developed by Google engineers. Participating is a fun way to grow your coding skills—and potentially explore opportunities at Google.

Inviting you to solve some fun and interesting problems on Sunday, July 29, 2018 05:00 UTC.

Dashboard can be accessed here during the contest. Problem analysis will be published soon after the contest.

  • Vote: I like it
  • +41
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it +5 Vote: I do not like it

24 hours bump!

»
6 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Bump! The contest is one hour away :)

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve A.Candies ?

  • »
    »
    6 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    The analysis is up! You can read the analysis for problem A in https://code.google.com/codejam/contest/6364486/dashboard#s=a&a=0

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +2 Vote: I do not like it

      I used two pointers approach for problem A. I was consistently getting Incorrect answer on small file itself. After the end of contest, I downloaded source file of other people on leaderboard and found that their output file was exactly same as my output file. Then, how can i get WA ? Can you please clarify ? Here is my Source Code

      • »
        »
        »
        »
        6 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I also got lots of WAs. I strongly recommended you to write a simple solution and compare their outputs for randomly-generated data. Here are my tips: - When checking a number is odd or not, don't simply use s[i] % 2 since s[i] may be negative, use (s[i] + (1LL << 32)) % 2 instead - For two pointer method, don't forget to check if the second pointer is at the left of the first pointer - Always use long long to avoid overflow

        • »
          »
          »
          »
          »
          6 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it
          • I have used s[i] % 2 != 0, which will be always true for odd number, since for even number s[i] % 2 = 0, irrespective of s[i] being positive or negative.
          • I have used #define int long long since the constraints were large and involved multiplications, so just to be in a safeside. So, there's no chance of overflow.
          • Morever, I compared my output file with people on top of leaderboard. Both output files are identical.
          • Can you please compare your output file with mine? Just to confirm that my code is correct
      • »
        »
        »
        »
        6 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Did you run the codes with the same input file? Because sometimes small inputs are different for two different people, As far as I remember, only the large input is the same for everybody.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      Here is my submission screenshot
      • »
        »
        »
        »
        6 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You're not the first one with this problem, they just don't care about platform bugs.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      I used the two pointer approach too. And as vivek_shah mentioned, I too was getting WA on the small input. I request you to help me out. Here's my source https://ideone.com/zrYSlH

      • »
        »
        »
        »
        6 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        The two pointer approach is not going to work. I used the two pointer approach in the contest and was able to solve for small data set but for the large one it failed. You should check the content analysis it provides the correct solution i.e using BST.