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

Автор darkshadows, история, 6 лет назад, По-английски

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.

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

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

24 hours bump!

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

Bump! The contest is one hour away :)

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

How to solve A.Candies ?

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

    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 лет назад, # ^ |
        Проголосовать: нравится +2 Проголосовать: не нравится

      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 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        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 лет назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится
          • 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 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        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 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится
      Here is my submission screenshot
      • »
        »
        »
        »
        6 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

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

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

      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 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        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.