By arsijo, 6 years ago, In English

Hi,

I am happy to announce that Lyft Level 5 Challenge 2018 — Final Round will be held in Palo Alto on Nov/04/2018 21:10 (Moscow time). The official round contains six problems and will last for two hours.

Winners will receive:

  • First place: $2000
  • Second place: $1000
  • Third place: $500

Here is the list of onsite finalists:

tourist LHiC scott_wu ksun48 Marcin_smu
matthew99 ecnerwala Kostroma RomaWhite Errichto
ACRush *ikatanic ilyakor Arterm zxqfl
desert97 Fdg neal KADR liympanda
LiChenKoh fmqjpt waterfall liymbear xiaowuc1
azneyes chenmark balakrishnan *YerzhanU

If you are interested in an internship or a job at Lyft, follow the link below.

Interested in an internship or a job at Lyft?

If you are not participating in the Final Round, you will be able to take part in rated open divisions. Each of them contains six problems and will last for two and a half hours.

This round was prepared by _h_, Lewin, majk, Noam527, stanislav.bezkorovainyi, and me.

Thank you to 300iq, cdkrot, BigBag, danya.smelskiy, Fekete, MrDindows, Nazikk, Sonechko, winger, MaxZubec for help with testing.

Special thanks to KAN for helping me with coordinating, MikeMirzayanov for Polygon and Codeforces, and Lyft for organizing this competition.

If you have never solved interactive problems before, please read this.

Scoring distribution:

Div1 and onsite:

750-1250-1500-2000-2750-3000

Div2:

500-1000-1750-2250-2500-3000

We have onsite issues, the contest was postponed by at least 5 minutes.

Because of the onsite round, the system testing will be in an hour after the round.

Contest is over!

Congratulations to the winners!

Onsite competition:

1 tourist
2 scott_wu
3 ecnerwala
4 RomaWhite
5 Errichto
6 ACRush
7 Arterm

Div 1:

1 Radewoosh
2 mnbvmar
3 Benq
4 DearMargaret
5 Reyna

Div 2:

1 mrscherry
2 Kekmaster
3 brandonzhang
4 ponda
5 ---Grigor---

Editorial is available here.

Are you looking for photos from the onsite round? It is here.

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

| Write comment?
»
6 years ago, # |
  Vote: I like it +15 Vote: I do not like it

Is there going to be a livestream of the onsite finals?

»
6 years ago, # |
Rev. 3   Vote: I like it -31 Vote: I do not like it

:))

»
6 years ago, # |
Rev. 2   Vote: I like it -27 Vote: I do not like it

Oh, very awkward time for China and Siberia.

»
6 years ago, # |
Rev. 4   Vote: I like it +42 Vote: I do not like it

Hello, I have cancelled the onsite final due to unexpected time conflict. I have sent email to Lyft Level 5 staff who informed me about event logistics, but they have never replied me. Could you please remove me from the list and allow me to participate in the open mirror? lyft

Update: they just replied me.

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

Why is the official round shorter than the div1 round? Is it rated huh?

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

    The first division will be easier because of this extra half of hour. And yes, all three rounds will be rated.

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

if comments on the codeforce is directly uploaded whether admin will be accepted then only upload it,,can u say anyone?

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

    Mate, what do you want to say exactly? If you want to ask whether your comment is first verified by admins and then uploaded then it is not the case. If that would have been the case then some people wouldn't shit here anything they want.

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

Regarding to random hoodies from the last round, which will be the score from which the seed is generated?

The winner's score from onsite or some other score?

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

    Good question!

    We are using the onsite round.

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

Can someone explain how organizers are able to check if participants solve problems themselves, not with a team of helpers, which is quite important when people are struggling for financial prize.

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

Any updates for the t-shirts of the elimination round?

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

Ok, so there is now daylight savings time shift... so it's at 10 am PST now? Or still 11?

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

    I don't think the countdown is affected by daylight savings.

»
6 years ago, # |
Rev. 2   Vote: I like it -14 Vote: I do not like it


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

Why YerzhanU's handle with star?

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

I think that today tourist will come back

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

Atleast 5 minutes :(

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

Finally some questions with creativity shout out to lyft :)

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

What could be pretest 12 for Problem C? i kept getting WA !

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

    I think it is something like that:

    3 10
    2 
    4 
    6
    2 2 1
    1 1 3
    2 2 5
    1 2 6
    1 2 7
    3 4 2
    3 4 4
    5 6 1
    5 6 3
    5 6 5
    
    Ans: 1
    
»
6 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Oh God 10 more seconds please...

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

    Same here. I fixed a bug in my solution about 30 seconds before the end, but didn't get time to submit.

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

how to solve Div2 C ?

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

    Realise that you only need horizontal lines with that starts from 1. Sort horizontal lines and vertical lines, and then iterate trough verticals, and figure out if you don't use first i verticals, what is the answer. Output is minimal answer from all.

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

      I was trying to solve it like that but Idk what I'm missing

      after deleting all lines that starts with 1 and end with 1e9 and considering only the lines that start with 1 what's next ?

      I thought I need to see the longest horizental line and delete all vertical lines that blocks it but that was wrong ofcourse

      it's like dp or what how could we get the min

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

        Nothing that's it, maybe you just forgot about some condition, like me (wa on 12). But that is main idea.

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

    If you delete first A vertical lines (A+1'th is not deleted) then you have to delete horizontal lines too but only those such that x1=1 and x2>=x value of A+1'th vertical line

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

friendship ended with algorithms, ad-hoc is new best friend

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

Is C can be solved with segment tree ?

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

    I tried using 2 segment tree but didn't manage to get AC , but i think it can be solved using segment tree .

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

      Why 2? my idea is to add 1 to range [x1, x2] for horizontal spells and add 1 to range [x, 1e9] for vertical spells, then find the minimum, can any body confirm ?

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

    Yes, though not necessarily. Prefix sum is enough.

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

      Can you please elaborate?

      • »
        »
        »
        »
        6 years ago, # ^ |
        Rev. 3   Vote: I like it +4 Vote: I do not like it

        Let's denote f[i] as the number of horizontal lines that need to be removed, if we've removed i vertical lines beforehand. Obviously, the removed vertical lines have to be the leftmost ones.

        About the horizontal lines, it's certain that we will only remove such with leftmost x-coordinate equals to 1. Now we have to find out the maximum i (the number of removed vertical lines) such as that horizontal line still blocks our way — this can be done through binary search the rightmost x-coordinate of that line — let's denote the found value x.

        Then, all f(i) with 0 ≤ i ≤ x will be increased by 1.

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

Isn't Timus 1003 same as div. 1 D?

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

    That one is somewhat easier, because there you can also do some sort of binary search. Div1D forces you to write an "augmented DSU". Though they are clearly similar.

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

      The problem is mine. I didn't intend to copy from any problem, and also none of the testers brought up any related problem. The problem is different, but I admit it can still help.

      Also, the problem is still solvable with merge small to big, so no need for augmented DSU (although I think it is simpler to code).

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

        Can you please provide the solution using small to big? During the contest I too tried with the same approach but could not find the bug in my implemented code till the end.

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

    This is exactly the same question as in the IIT Kgp regionals for 2017/18. That was for a tree but the solution is exactly the same.

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

I really liked C, it was a little bit hard to solve it but the idea is nice. Hard contest overall!

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

    So how did you solve it?

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

      First sort the vertical lines by position and horizontal lines by size (x2 - x1 + 1), when taking the horizontal lines you just need the ones that start at 1, why? because if a horizontal line has x1 >= 2 you can always escape through 1.

      This is the trick of this problem. :)

      Now you will try to brute force, you will try to remove first vertical line and see if you can reach the top row of the chessboard, after this the second vertical line and so on. Each time you have to count the number of horizontal lines those size is larger or equal with v[i] (use binary search) and check if this is better than the current answer.

      by v[i] i mean the position of vertical line with index i after sorting.

      Hope you understood.

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

problem E is cool, I wish I'd submit it.

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

How to solve div2E(div1C)? I thought I could solve this problem :(

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

    As an observation, there will always be k extreme points in a convex polygon (k ≤ 4), so every f(x) with x ≥ k will return the maximum answer.

    The solution for f(3) and convex polygon with 4 extreme points can be brute-forced. Simply traverse through all points, and with each point, match it with 2 out of 4 extreme points of the polygon.

    Total complexity is O(6 * n), can be reduced to O(n) by further geometrical observations.

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

      convex polygon with 4 extreme points

      wait what?

      I thought for n = 4 it was just the rectangle with side lengths of max x — min x, max y — min y?

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

        It's correct for f(4) and further.

        We still have f(3) left to calculate.

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

          How to solve div2 B as i was using binary search and overall time complexity was O(mlogn)45304679 it was giving me tle

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

            The input seems quite large. Did you use fast I/O methods in your solution?

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

              i just used scanf , printf afterwards but could not succeed.

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

                If I were you I'd go binary search as well. Without your solution (submission pages are inaccessible now), I cannot say for sure what you've done wrong.

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

      Ohhh, I was confused about this for a while, but then I realized that the set of points had to be convex. That makes the problem a lot easier XP

    • »
      »
      »
      6 years ago, # ^ |
      Rev. 3   Vote: I like it +5 Vote: I do not like it

      You need to consider at most 8 extreme points because there can exist two points with x = max xi, but it is preferable to choose only one of them, and the same holds for y.

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

        I think you can choose any one from each pair and get the same answer.

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

          No, because if you choose triple "upmost, downmost and leftmost" points, then you care about x coordinate of both upmost and leftmost: the larger it is, the bigger is "Manhattan perimeter". So if you have pair of both upmost and downmost points, you must choose the rightmost of them

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

            I am only considering the case when we are calculating f(k) where k>=4. The difference in x-coordinate of the two upmost points will be compensated when we are going to take the manhattan distance with the rightmost point. For f(3) as AkiLotus mentioned, we will have to check all points with each pair from the 4 extreme points.

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

            No, checking 4 points is enough because those other rightmost points will eventually be one of the n-4 alternative third points, and the rightmost of both on it's own is enough.

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

              Not obvious, but I believe :)

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

      Nice Explanation!

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

Can someone explain how to solve Div1 A/Div2 C (The Tower is Going Home) problem?

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

    If a horizontal wall doesn't start at 0, we can always go around it, so discard those. Also, y-coordinate of horizontal walls doesn't matter.

    Sort horizontal walls by their right end's x-coordinate, and vertical walls by their x-coordinate. Loop over how many horizontal walls we discard. Obviously the optimal ones to discard are always the one with maximal x-coordinate. Then, binary search how many vertical intervals we have to remove, so that we can reach the top row, when we have removed the given amount of horizontal intervals.

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

How do we solve div1 D? I was thinking something like dynamic segment tree but I ended up with nothing.

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

    When you know that xor on segment [l, r) is equal to x, you add edge between vertex l and r with cost x. Now to answer query [l, r) you need to find xor on the path between l and r (xor on costs of the edges). This can be done similar to LCA.

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

    Consider the prefix xor-sum array p0, p1, ..., pn. Now the problem is basically giving you equations and asking for . Consider a graph on n + 1 nodes where u and v are connected by an edge of cost w iff . Then query is xor-sum of path from u to v. You can handle these with DSU (recompute distance from root for smaller tree when merging two trees).

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

Take all the vertical lines and sort them in increasing order.Now suppose you are considering a vertical line i,then you have to remove i-1 vertical lines + horizontal lines starting from 1 and ending at some position greater then i.This way,you can select minimum lines to delete. Corner cases can be handled separately.

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

    What are the corner cases ? My approach is same. But got WA on test 6.

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

Is this solution for D?

Ask "B y1" and answer for this is p

1) If p exist in first set then we are done
2) Else, find closest node to p such that it belongs to first set. Call it q. Ask for "A q" and answer for this is T. If T exist in second test then solution is q else there are no common nodes.

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

Very well explained problems. Even though some of the problems were long and complicated, the statements were quite clear and the sample test cases did the rest. Kudos to the problem setters!

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

Can admin allow access to submission pages? Thanks

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

How to solve div2 B as i was using binary search and overall time complexity was O(mlogn)45299906 it was giving me tle

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

    Just find the immediate left and immediate right driver for each rider. You can do this by first scanning the array from left to right to find the immediate left driver for each rider. Then scan the array from right to left to find the immediate right driver for each rider. While doing so, maintain the distance as well as the position of the driver. Now for each rider, compare the left and the right distance, whichever is shorter, increase the count for that driver's position.

»
6 years ago, # |
Rev. 2   Vote: I like it +18 Vote: I do not like it

I solve C but can't solve B... too sad. maximum question=5, n=1000, so I try to think about O(lgn/2) solution lol

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

    It can be done in at most two queries:

    We are given at least one node X that is in Li's subtree (with his labeling). We ask B X. If the given label is one of our chosen vertexes, great. Otherwise, we are given node Z (in our labeling).

    We find the closest node to Z that is in our chosen subtree. Let's call it Y. Now suppose there is a node X in the intersection of the two subtrees. Since node Y is on the path between X and Z, then it must be in Li's subtree aswell, so Y must be a common vertex if an intersection exists. So we just ask A Y: if the given label is one of

    y1, y2, ..., yk2

    then Y is in the intersection. Otherwise output -1

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

Div 2 C ? is this related to disjoint union? or else whats the best solution?

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

Not sure if I should sleep or wait for systests

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

ObservationForces!!

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

    What would be your ideal problem set then?

    The way I see it, to solve any nontrivial problem you need to make several observations. What is the alternative? Implement well-known but difficult algorithms? Because in my opinion the former is vastly superior to the latter.

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

      Exactly! If the problems do not require new and different observations, one that knows the required algorithms will just be in a typing competition (if one don't just copy and paste codes).

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

      Why did you think that was a negative comment? It's not like I wrote 'SpeedForces' or 'ImplementationForces'. I have huge respect for problem setters who can make tough problems that don't require complex algorithms or data structures.

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

Why is there such a long delay for system tests too start? Should I just go to sleep?

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

    Because of the onsite round, the system testing will be in an hour after the round.

    It's already over anyway.

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

Who won the onsite finals????

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

Great Problem Set!!! Kudos to the authors!!!!!!!

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

Div2 C. Why my solution failed on test no. 17 I used Difference array and Binary search.? http://codeforces.net/contest/1075/submission/45302142

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

Two Div.2 problems were about chess. That reminded me that World Chess Championship will start in a few days :)

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

Getting MLE in DIV-2(D) . submission — 45317188 . Why?

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

    The judge responded with -1 and you didnt terminate your program so you got any verdict.

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

      Thanks for your reply.

      I've checked it 45319433 . If my tracing is correct, the judge didn't reply with -1.

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

    Possibly your BFS loops infinitely, you don't really check whether you're not visiting your parent again.

»
6 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

how this test Output (0) ?? not (1) 4 6 3 6 9 12 1 2 2 2 3 2 2 3 4 3 1000000000 2 3 1000000000 3 3 1000000000 4 arsijo

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

For DIV2 C.
Is this a valid input?
1 2
4
1 2 2
3 4 2

If yes, then answer should be 1?

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

    No, this is not valid.

    According to the problem statement "The peculiarity of these spells is that it is impossible for a certain pair of such spells to have a common point". In that testcase, there is one common point (2, 2). Therefore, it is not valid.