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

Автор eduardische, 11 лет назад, По-русски

Напоминаю, что в воскресенье в 00:00 по Москве состоится второй раунд Facebook Hacker Cup 2015. По результатам первого раунда, 732 участника продолжат борьбу. Во втором раунде, 100 лучших пройдут в третий раунд, а 550 лучших получат футболки. Раунд продлится 3 часа. Для участников, задачи будут доступны здесь, а таблица результатов тут.

UPD: Раунд закончен, опубликованы предварительные результаты. Катоффы по ним:

  • Проход в третий раунд: 55 очков (A+B+C) с временем ≤ 2:21:53
  • Майка Facebook Hacker Cup 2015: 10 очков (А) с временем ≤ 30:23
  • Проголосовать: нравится
  • +67
  • Проголосовать: не нравится

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

Я бы сказал, что завтра в 0:00. И добавил ссылку на задачи и таблицу результатов.

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

    Спасибо, добавил. Хотя лично я фанат японской нотации времени, где считается нормой указывать времена в формате 26:00 и.т.п. для сохранения ассосиации к одному дню (например, ТВ или бары).

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

      В такой нотации не очень понятно, когда заканчивается один день и начинается другой.

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

        А зачем это понимать?

        Я не знал, что это японская система нотации времён, но в расчётах сам мысленно всегда так и соображал: "ага, этот раунд начнётся завтра в 24:00 и закончится в 27:00". Понятно, что для большинства людей в моём часовом поясе раунд, который длится с 00:00 по 03:00 воскресенья, это именно продолжение дня субботы, а не раннее начало дня воскресенья.

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

Did they send notification by email this time? I didn't receive it...

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

Hmm contest starts 5am here.. Not sure if I should go to sleep or stay awake (・_・ヾ

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

Good luck, everybody! May we have a smoother round than last time :)

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

I want to express my gratitude towards the authors of the last task. I believed I love segment trees so much that I can code them really quick. You showed me how wrong I was.

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

How to solve the 25 points problem?

I've tried a greedy approach by picking up the string that will decrease the cost and in case of equal the one that has less similar suffix strings. But unfortunately I got a bug that I couldn't discover before the 6 minutes passed :(

Is my approach correct?

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

    I used dynamic programming (for trie nodes in DFS order), but I don't know if a greedy solution is possible.

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

    I did a dynamic programming, after you sort the strings: best[i][j][l], the minimum cost if you put the i-th string, you already have j other strings, and the cost of adding it is l. When you add another string, you look at the last one added and it's cost l, and see if by adding the new string you'll change the cost, so you can take this into account (since the cost of a string i is determined by the previous and the next in the sorted array)

    It ran in in about 3 minutes.

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

    Greedy approach:

    1. start with all possible one character prefixes as S

    2. until you have K prefixes do steps 3-4:

    3. remove shortest prefix X with most direct childs from S

    4. add all prefixes starting with X and one character longer then X into S

    5. print sum of prefixes lengths in S (K oldest if you have too many)

    Special cases:

    • if prefix has only one indirect child there is no reason to remove it

    • if prefix is only direct child of its parent use its parent length for step 5

    • use word+'#' so every word ends in leaf. just make sure 'abc#' prefix length is 3.

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

Обожаю дебагать деревья отрезков в 4 ночи :/

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

Seems like last problem needs only accuracy, accuracy and accuracy :(

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

Why not N ≤ 100000 and M ≤ 100000 on Fox Socks? My computer couldn't run 1000000 in time...

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

I won't say, how I am impressed by the innovative and interesting task D, but am I the only one, who wrote log N solution per query, and I was able to get answers only to 11 of 20 tests due to big constant of segment tree and slow notebook?..

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

How to come up with last problem?

  • Hmm, lazy propagation can handle this one

  • This one too

  • We can use it for this problem either

...

Lets merge all of them to make single problem and see who codes faster?

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

Last problem, I finished implementing my code when there were 10 minutes left. My code passed first 4 pretests and failed the last one :(

What a great feeling.

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

    I found like 10 different bugs that didn't change answer on first 4 pretests, so if it makes you happy you can't really know how close you are to answer based on that :P

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

Furthermore, problem C has a tricky case from using DP approach if K = 1. If not considered separately, the code might output 0 instead of 1. However, no case with K = 1 was present in at least two people's inputs.

No comment on whether this is good or bad, but I hope K = 1 case wasn't present in only some people's inputs.

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

Can someone share tests/answers? I'm adding a training to the Gym. I have my answers for A-C, but not sure about them.

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

I want to say that quality of tests is... well, I don't want to use the word awful.

In my input for task C there wasn't any test with K = 1. Are you serious? At least there should be following test:


1 2 1 a b

I'm sure that 10% of AC solutions for this task will handle this test incorrectly. Techincally, the answer 0 here works (since we choose some word and empty prefix is enough to pick it), but there was a remark in the statement regarding non-empty prefixes.

It is such simple idea that there should always be testcases attaining maximum/minimum possible values of constraints...

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

Looks like YuukaKazami (Tom Chen) have submitted his solutions for R1 instead of R2 and thus got zero points instead of first place. What a pity.

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

    I thought there could be some victims when I saw all T=20...

    I have some suggestion to FHC:

    1) That kind of errors could be prevented if FHC does more sanity check on the output file. The output of Round 1 A is positive integers, but Round 2 A is yes/no.

    2) Change the number of test cases between the problems: Why T=20 for all problems?

    3) Even if sanity check found output file is wrong, the font for notifying this is not bolded or underlined, so there is some possibility to neglect the message. Some red-background box, like notifying problem statement changes, will work.

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

      1) Yup. For next year I plan to always include the sample cases as the first K cases in everybody's input. Then we can confirm that you at least match the sample output. That'll catch this along with a slew of other problems, like:

      • Not formatting "Case #X:" properly. We get a lot of "Case #X" and "Case X:".
      • Outputting the wrong number of decimal places
      • Strange whitespace. A bunch of people were tab-separating things in the output rather than space-separating.
      • Uploading your source as your output and vice versa (in the amusing case where your source has the same number of lines as the output should have).

      2) Yeah, I intend to change this too.

      3) Agreed. I'd like a more eye-catching UI for things like this, and for clarification announcements. The current UI is at least 4 years old.

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

        Any progress on "For next year I plan to always include the sample cases as the first K cases in everybody's input."?

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

          As far as I noticed, they are always included but somewhere in the middle because tests are shuffled.

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

            I came here to ask the exact same question! I think the sample cases were also included in a random order last year, so it seems they didn't implement this, which would be a really good change. I guess I should have bugged wjomlex personally when I got to see him :p

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

              Yeah, currently the samples are always included, but mixed in. We took a different approach of catching more PEs before they happen. If you have the wrong number of cases in your output, or the wrong number of tokens (contiguous non-whitespace characters) in a case, or your first tokens aren't "Case" and "#xx:", you'll get a formatting error right away and you'll be asked to resubmit.

              The idea of matching on the samples up front was largely to prevent PEs, not WAs, so if you have the right format, but don't match the samples, we won't say anything.

              We finally changed our legacy "every problem has 20 cases" thing this year (that was very silly), and we stopped requiring a specific number of decimal places for real values.

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

You increased number of T-shirts by 10%.

I suggest you to increase the number of the advancers by 10% too.

Just an idea from the guy on the 110-th place.

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

Can you give an estimate regarding the T-shirt shipment timing? It's not really a crucial thing right now, but I'm kinda worried about them getting stuck somewhere in the process. Smooth round by the way, I'm glad there were no technical issues this time.

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

Did you notice to ZhengJie rank 101 ? his total time is 2:21:54!! Just 1 second more than rank 100. Is it unfair or we should call him so unlucky person ?

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

    And what is unfair exactly?

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

      I remember that in ICPC World Final 2013, they gave a bronze medal to rank 13th just because of tiny difference in total time with the rank 12th.

      There was a debate on this here

      Anyway, I think it's not unfair if they accept all participants with total time less than 1 minute with rank 100.

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

        ICPC and FBHC are too different contests, why do FBHC organizers need to care about the decisions of ICPC organizers at all? This is not a common practice, I never seen this kind of "additional prizes" anywhere except ICPC, where all rules are weird (e.g. in Asia regionals, last year & the year before that, there was rule that in each of Singapore & Hong Kong, only 1 team can advance to WF).

        There are lots of reasons why we should not accept participants with 1 minute more:

        • Just because they are a bit unlucky, now top 100 have to fight more people in order to advance to top 25.
        • It's not fair to the guys with 61 seconds slower. Why did you choose the 60 seconds cutoff, why not 10 secs, 30 secs, 45 secs, 90 secs, 120secs...
        • Normal actions that organizers should take is to follow their rules. If they break the rules once just to let some guys with few seconds slower (note that in this case, there're no technical issues like last round), how do we know if they will follow their own rules in future?
  • »
    »
    11 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Bad luck "only"...

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

For Fox Socks, the gap between the 4th and the 5th sample testcases are quite huge. I failed all the sample testcases on my first run. Luckily, the first four sample testcases are small (N=5) and I can debug them. I fixed several mistakes and managed to get the first four sample testcases correct, but the last sample case is too big to debug with. Can't get the last sample correct until the end of the round :'(

Anyway, I'm still qualify to Round 3. Yeay!

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

    Nevertheless, correct output on last sample wasn't a proof the program correctness. At some moment (with some combination of bugs) I had all samples passing, but program was still giving wrong answer on some obvious cases with n = 2.

    The best idea for this task was to start with writing naive solution (implementing what is described in statement), checking that you understand complicated input format correctly, and only then writing the full solution and stressing it with a naive.

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

I was very lucky for the T-Shirt rank 550.

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

can anybody tell me how to reduce time complexity of my code for the problem Autocomplete Strikes Back

(http://mirror.codeforces.com/gym/100587/submission/9562793)

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

Can someone enlighten me please; I see the following pattern common amongst many AC solutions submitted for problem #2: all_critical, eg. @ http://attachment.fbsbx.com/hackercup_source.php?sid=369011793270735

  • why is it necessary to +1 here: sum = 1;
  • why must the sum be divided here (and why is the term to be divided 1 - notsele[i] ?: dp[i] = sum / (1 - notsele[i]);

Is this popular approach different from what the editorial note explains @ https://www.facebook.com/notes/facebook-hacker-cup/hacker-cup-2015-round-2-solutions/1051224511560116 ?

Thanks

  • »
    »
    11 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +8 Проголосовать: не нравится
    1. You have equation like dn = c0·d0 + c1·d1 + c2... d2 + ... + cn·dn, you can't calc d_n using it itself, but you now know that dn(1 - cn) = c0·d0 + c1·d1 + c2... d2 + ... + cn - 1·dn - 1
    • »
      »
      »
      11 лет назад, скрыть # ^ |
      Rev. 6  
      Проголосовать: нравится 0 Проголосовать: не нравится

      Explanation posted as top FB comment to official editorial:

      We can reduce the time complexity for "All Critical" to O(20^2) by computing the infinite sum in a different way, without worrying about precision and L.
      Let E[n] be the expected number of playthroughs to get n critical bars.
      E[0] = 0
      E[n] = Σ[0 ≤ k ≤ n] C(n,k) * p^k * (1-p)^(n-k) * (1+E[n-k])
      We select k critical bars which we get (we got them in 1 playthrough), the remaining (n-k) we don't get (we will get them eventually in E[n-k] playthroughs).
      This formula is recursive since there is E[n] on both sides of the equation, but this can be easily solved resulting in:
      E[n] = ((1-p)^n + Σ[1 ≤ k ≤ n] C(n,k) * p^k * (1-p)^(n-k) * (1+E[n-k])) / (1-(1-p)^n)
      E[20] is the answer
      

      My question:

      In your equation, why is it C(n,k), and not C(20-(n-k), k), since you will achieve (n-k) critical bars in E[n-k] playthroughs, but in your 1 playthrough, you can select k out of the remaining 20 (ie. total) — (n-k) sections of that song?
      
»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Как долго футболки идут из калифорнии в Питер?

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

Yay! Received my T-Shirt today. =D

(Classy of Facebook to use FedEx delivery by the door. ^^)

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

Just a small clarification in 20 pt problem . In the editorial , we need to calculate upto 20 powers of p and 1-p but these may become so small that P(s,i) may become zero which infact is not exactly zero. This leads to all P(s,i) values to become zero. How to overcome this?