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

Автор Zlobober, 11 лет назад, По-английски

Tomorrow (January 23rd) at 10:00 AM PST / 21:00 MSK there will be a second round of Facebook Hacker Cup. Don't miss!

I still don't know how to get to the dashboard from the official page (http://facebook.com/hackercup) through the links. Can somebody of the officials that spend time on CodeForces teach me how do I get there in deterministic manner? Maybe a video tutorial? Or maybe you can just make design compatible with human put the big link to it somewhere on the main page? After all, it is the most important link people want to see on the competition page :(

For those having the same headache with getting there, a link to the list of all rounds: link.

Let's discuss problems here.

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

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +120 Проголосовать: не нравится

"10:00 AM PST / 22:00 MSK"

Nice trick, but I'm sure it should be 21:00 MSK.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

It would also be better to have link to the dashboard in e-mail.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Also Top 200 will be advanced to round 3 and Top 500 will recieve an oficial T-shirt

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +54 Проголосовать: не нравится

Getting to the dashboard is part of the challenge. It's like a round 1.5.

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

    We aim to always keep you on your toes.

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

      I have a question about the rules. Is it fine to submit publicly available code authored by others? More specifically, I'm interested in code snippets from e-maxx.ru

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

        Any code written before a round starts is fair game. I would treat it the same as codebook code.

        Definitely nobody should be pointing people to public code during a round, since that constitutes communication which is disallowed. But certainly anything preexisting that you're aware of or discover for yourself during a round is OK.

        If you have any concerns about any submissions, feel free to message me.

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

This link always had current round dashboard acessible.

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

Sad, wasted too much time on C. Only 30 mins left for A, and couldn't solve within time :. Was it greedy for A?

»
11 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

273 full scores? I hope there's going to be a lot of fails.

UPD: 177. With an average 1 hour submission time for passing.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +35 Проголосовать: не нравится

The (probably, correct, as I've compared it with some other contestants) solutions and the answers for all problems. In each directory 02 is a test, and 02.r is the answer for it.

Link.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

So, what is the intended solution for D? It's not straightforward Min-Cost-Max-Flow for all O(nc2) transitions (which makes total running time O(nc5)), is it?

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

how to correctly get probability? without -nan(ind)

»
11 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

D was quite a bit of work, I submitted a few minutes before time but I doubt it's correct (edit: yay it passed). I used dynamic programming, where I had to do weighted matching multiple times in each vertex to get the answer. Did anyone have a nicer solution?

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

    If you think that's hard to code, you must not have seen the "Gaussian elimination and matrix exponentiation inside a segment tree" stunts that they pulled last year. :P

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

How to solve problem B? We can use BigDecimal to calculate binomial coefficients and powers of p and (1-p) but it is too long (TLE).

»
11 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

According to the scoreboard, 273 people submitted all four problems. I wonder how many of them will actually get full score.

UPD: results are available, 177 people have full score.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +36 Проголосовать: не нравится

That was really horrible contest in fact. 3 goddamn simple problems, long double solution passed in B, "copy-paste from emaxx Hungarian algo" in straightforward D.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится -90 Проголосовать: не нравится

That's the cost of changing rules in the middle of contest. Minus T-shirt. I finished 567th, and 100% sure that if rules weren't changed and only 560 people participated in Round 2, I would easily get in 500.

Agree it is fairer this way, but... changing rules in the middle of competition is not fair anyway.

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

    Strange response from you guys. If you think that my statement is factually incorrect — it is correct, very easy to prove, if it's not obvious. If you are not happy that somebody was hurt by change in rules — sorry — might be a revelation — when somebody gains somebody loses. If you think that getting into 500 in Round 1 means less then getting into 500 in Round 2 — that's ok for you to think so. It's not about what you think it is about what rules are And rules were changed in the middle of the contests.

    • »
      »
      »
      11 лет назад, скрыть # ^ |
      ← Rev. 2  
      Проголосовать: нравится +21 Проголосовать: не нравится

      As I remember, Round 1 rules was changed before Round 1 started. Seems fair.

      Besides that, you can't know what place you get in Round 1 if rules wasn't changed — I guess a lot of people solved no more tasks than they needed to proceed further according to new rules. So you could easily didn't pass to Round 2 at all.

      • »
        »
        »
        »
        11 лет назад, скрыть # ^ |
        ← Rev. 2  
        Проголосовать: нравится -20 Проголосовать: не нравится

        I agree that on 22nd those people who were the strongest on 22nd won — no arguing about that. But below few top places there is actually lots of randomness involved, so modifying the rules does modify the end result.

        Argument about a lot of people who decided to solve just 2 easy problems (1,2,3) or one hard problem in round 1 to get through — I don't buy it. Smallest quirk can kick you out of competition, why risking it? Even those people, who are absolutely sure that they don't have even a minimal mistake in their solution — for them it would take another 15 minutes to solve third problem "just in case". So I don't think there were more then a handful of people following that strategy (solving less then three problems, because that's enough to proceed).

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

          Because the problems are not that interesting?

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

          Why risk it? Because one doesn't care that much and doesn't have that much time/energy?

          I was one of the "handful people" who followed that strategy. I figured that if I wouldn't be able to solve problem D in Round 1 flawlessly in one attempt, then I wouldn't be worthy of Round 2. Now I didn't participate in Round 2 anyway (because of lack of time and motivation), but still, the rules this year were way more balanced than last year.

          Last year, you were more or less guaranteed to get a T-Shirt if you managed to qualify to Round 2, for which (largely) only time to verify thoroughly that your solutions in Round 1 were correct was needed. So if we want to reward people who can solve problems (quickly and often correctly), rather than people with a lot of time to spare, then a lower threshold in Round 1 is definitely the way to go. (And seriously, a Round 2 with about 600-700 something participants where 500, actually 550 last year, gets a T-Shirt, is not balanced in any way.)

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

            I figured that if I wouldn't be able to solve problem D in Round 1 flawlessly in one attempt, then I wouldn't be worthy of Round 2.

            That's a bit too harsh, mistakes happen. Just look at how many excellent contestants got eliminated in round 2 by having one problem fail. I have also seen red coders failing as much as 3 problems in the same round...

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

              I failed D because I ran DFS from vertex 1 instead of 0 to test if the answer stays the same, then forgot to change it back. Then I had all cases correct except for the single-vertex case :c

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

      If you think that getting into 500 in Round 1 means less then getting into 500 in Round 2 — that's ok for you to think so.

      It does mean less — in round 1 you passed on points, so if you wanted to pass you could just start the contest ~20 hours after it begun, do the first two problems and call it a day — which I assume a lot of people did. Now that your actual ranking matters, these people will start on time and do all the problems, so it makes sense that it's harder to get into the top 500.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +21 Проголосовать: не нравится

Test cases on B may be weak; I passed by computing all binomials and powers of the probability, p. Of course, even though I stored these values in a long double, I would still expect precision problems to arise.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Ok, classic T-shirt giveaway. First reply = free T-shirt.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +39 Проголосовать: не нравится

C was a nice problem, but the test input is weak... After the contest, I implemented a simple brute force solution and noticed that it solved the input in 3 minutes, because almost all test cases were small.

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

In Gym: 2016 Facebook Hacker Cup, Round 2

Tests in D have been splitted to contain at most 5 test cases.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

Brutal round :( Solving at least 3 problems (including the last one) is needed to advance :'(

»
11 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

I implemented the intended idea for problem D, but my program only fits into 6min if I split it in 3 processes in a 5 year old computer. I only fixed a bug with 2 min left and the program didn't finish until the end of the contest.

I think the MCMF implementation I used is reasonably fast ( http://ideone.com/OREX0W ), I don't understand why the limits were so tight.

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

    I think fastest MCMF is still much slower than Hungarian. My code runs in 20s in my laptop (~ 4 times faster than Codeforces).

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

    Well, you can speed up your solutions K times by noticing that you can actually split coloring vertexes with even and odd distances to root and thus eliminate one of the parameters — the color of current node.

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

      Yeah, I've seen that idea in Egor's comment.

      My 'complaint' is due to the editorial explaining the solution like I did with the current label as one of the state parameters.

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

        Well, if you put it that way... Your code on my notebook runs in one and a half minute. And it can be further reduced by half a minute by replacing set with priority queue. And did you compile it with optimisations ? Without them it indeed runs in 7-8 minutes.

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

          Yes, I use -O2. I picked this version from my library because it's shorter code and has been efficient enough for contests.

          I didn't think my laptop was that slow. Ouch!

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

            There was only 1666 participants in this round. why don't facebook use online judging system at least from this round on? It could help people like mogers.

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

              It gives people the freedom to use whatever tools they prefer.

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

                The context was about your slow laptop and I'm showing benefits of judging all participant's code with the same judging system. Nobody would feel unlucky then although writing correct solutions.

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

                  There are two main reasons Hacker Cup and GCJ use the run-the-code-yourself format:

                  1) People can use basically any language they want, and any libraries they want. This affords a lot of flexibility that encourages more participation.

                  2) We don't have to maintain a judging system. Ask MikeMirzayanov about running Codeforces. It's a ton of work. Hacker Cup and GCJ are side projects that exist largely as labours of love.

                  The main disadvantage of this format is that people have different hardware and different internet connections. We try to err on the side of giving more than sufficient time. For the problem in question, we have a judge solution in Java that runs in 6 seconds on a 3-year-old mid-level laptop. I think it does O(NK) passes of flow, and we have another solution with O(NK^2) passes of flow that takes about 30 seconds.

        • »
          »
          »
          »
          »
          11 лет назад, скрыть # ^ |
          ← Rev. 2  
          Проголосовать: нравится 0 Проголосовать: не нравится

          I just checked how my code would behave with EvenImage 's MCMF code. It solves the input data in 50s on my computer.

          I would have qualified to Round3 with this. Lesson learned

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

    MCMF can be used to solve weighted bipartite matching? Do you have any article about that? I thought Hungarian is the only way ?

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

      Yes. Maximum Flow solves the unweighted version and MCMF the weighted one. The topcoder tutorial on MCMF explains this application.

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

      I do not have any article, but here is the general idea.

      You have a bipartite graph with costs assigned to the edges. Lets also assign capacity equal to 1 to all of this edges. Let's create two fictious vertices — source and sink. Connect source to all of the vertices of the left part of the graph using edges with capcity = 1, cost = 0. Connect all of the vertices of the right part to the sink using edges with capcity = 1, cost = 0. Find MCMF between source and sink.

      All of the edges in this description are directed.

      That's it.

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

        Thank you both mogers and Fcdkbear, so, my understanding is we create a flow graph with capacity for each edge is one, and cost from left to right is the assignment cost, and cost from right to left is negative of assignment cost, then we run Dijkstra instead of normal BFS to calculate the MCMF, is that correct?

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

          That's not completely right.

          1) You've forgotten about source and sink vertices.

          2) The capacity of reversed edges (edges from right to left in your terminology) should be zero (as in usual flow network)

          3) You can't just run Dijkstra's algorithm, because it is not working with negative weights. Some people use some modifications of Dijkstra's algorithm. I usually use Bellman-Ford algorithm (it's implemetation based on queue) for this.

»
11 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Oh no, I do C ALMOST correctly, just forget one last mod. However, even if I get that, I would still not be able to get a T-shirt (around rank 560 if C was correct). This year there are too many contestants (and too many excellent contestants), I read that last year you just need 1 problem to be in top 500.

Anyway, great problems, and great experience :D

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

Damn. I totally forgot about hackercup. I wish they would send a mail 3-4 hours before the round start :(

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Did anybody receive their tshirt yet?