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

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

Throughout the year, Google Code Jam hosts online Kickstart rounds to give students 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.

Inviting you to solve some fun and interesting problems this Sunday, March 18, 2018 05:00 UTC – 08:00 UTC.

Link to contest dashboard
Problem analysis will be published soon after the contest.

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

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

A gentle reminder, the contest is about to start in 1:30 hrs!!! GoodLuck to all those who are participating :)

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

Seems like APAC is still using the old way of judging solutions: downloading/uploading i/o files. I am saying "old" cause I heard CodeJam will be shifting to the traditional method of submitting source code and running it on their server for judging.

Anyways, since we have to download input and run the solution on our OWN pc, I think this blog post will be helpful: Increase Stack Size in C++ IDE Codeblocks.

This will help you avoid getting Run Time Error while running your solution against large dataset :)

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

Fingers crossed, I might have submitted the small output for problem B, hopefully I stay at the third place at the end. :/

Edit: Screw it, I won't have 100% score after system test, I ACTUALLY SUBMITTED THE SMALL OUTPUT FOR LARGE OUTPUT

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

I was in top 30 previous year, but nobody has contacted me. Which score is good enough for interview invitation?

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

please dont say that B was ruined by allowing O(n*k) solutions to pass.

Also is there a determinsitic approach for C without using hashes

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

    Yes. My solution was O(n*k) and it passed. I know, its weird.

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

    what do you mean by "allowing O(n*k) solution to pass"? AFAIK google doesnt run your solution on their servers, only the output is matched with the correct output.

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

    Expected complexity is O(k*logn) right?

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

    Two main motivations to allow O(N*K) to pass were a. optimize for smaller input files and b. binary search not being the main crux of the problem.

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

      Lol. I overkilled the question using convexhulls.I did not notice the easier greedy part. That was the reason I was sad about O(n*k) solutions .Otherwise there is not much in adding binary search.

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

      There is no need of binary search though. You can just keep shifting the x pointer to the right, as Ek is increasing, and so is xk. Can be done O(n logn + k).

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

How to solve B and C ?

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

So, who else got into the following dilemma: should I solve A using greedy method or digit dp? :p

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

for C-large, isn't there sth missing in the editorial? How do I find which dict entries match for a certain length and frequency array (in O(1)), hashing with factor 26?

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

    When you move one position to right, frequency of one character increases and that of another decreases. You just account for this change and update the hash. This takes overall O(N) for a particular length.

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

      The value of N is too strict, even my solution which follows same complexity didn't passed because its update involved a few more multiplications and additions.

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

        I don't think so. For large dataset, my code runs in 11s, and we have 8 minutes. Link to code

        EDIT : A possible reason for TLE is that when you access map using operator [], you also insert the element and it might increase the size of your map to , which is a little too much. For example, if I remove the 61st line from my code, it would give TLE

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

          Thanks, you are correct. This is the reason why unordered_map was giving TLE in my code.

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

How can we solve problem B without dp .

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

Problem A can be solved without implementing both decrease and increase case. I'm surprised that this is not mentioned in the editorial. This trick is really important to reduce complex implementation.

When you implemented decrease case as solve(n), you can calculate increase case by solve(8888888888888888 — n).