Vladik's blog

By Vladik, 9 years ago, translation, In English

Good day to everybody!

The next round for the participants of the second division will be held at September 22, 2015 at 19:30 MSK. Traditionally, the members of the first division may take part in the contest out of competition.

I (Vladislav Vishnevski) and igdor99(Igor Doroshev) are the authors of the round. We would like to please Zlobober (Maxim Akhmedov) for the assistance in the preparation of tasks, Delinur(Maria Belova) for translating statements into English, MikeMirzayanov(Mike Mirzayanov) for remarkable systems Codeforces and Polygon, as well as our friends daksenik(Dmitry Aksenik) and irevt(Ivan Revt) for their assistance in the round preparation. This is our first round, and, we hope, it won't be the last one!

You will be proposed 5 tasks and 2 hours for their solution.

The protagonist of the round is the parrot Kefa, who likes money and restaurants.

Good luck and high rating!

UPD: The scores — 750-1250-1500-2000-2500.

UPD: Editorial!

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

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

3..2..1..Go!

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

Summary: Vladik and igdor99 would like to please Zlobober, Delinur, Mike and RevtIvan. It looks like they will have their hands full for a while.

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

    I'm sure they will all be pleased if the round goes well :)

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

      I assume Jefe tried to go for an obvious innuendo. I learn more about CF community every day.

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

        In part I wanted to point out they made an English mistake, swapping "Thank" for "Please".

»
9 years ago, # |
  Vote: I like it -7 Vote: I do not like it

Why no div1 :/

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

And in the hope ... that i shall get some hacks :D GL & HF :)

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

Oh it will be a magical round.

P.S : Please see the tags.

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

    And it's also a magical number of the round (321).

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

thanks for magical contest about parrot KEFA)

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

Do you mean Kefa ?

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

i just want raising rating .......

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

    Unfortunately, the probability of all users get raising rating is zero :(

»
9 years ago, # |
  Vote: I like it -16 Vote: I do not like it

hope to see hard math problems :)

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

    Maths problems is sometimes interesting(brainstorm). But too many maths problems will make my brain feel tired.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it -14 Vote: I do not like it

    Занимаешся футболом и любишь матиматические задачки????

    Страный ты однака...

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

Div. 1 guys do not make new accounts please. :)

  • »
    »
    9 years ago, # ^ |
      Vote: I like it -14 Vote: I do not like it

    Toooo_Simple

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

    Why did you make a new account then ?
    You're unrated and you know that some of div1 contestants make new accounts and you know the whole story, Then definitely you're not new to Codeforces and I can say that you already have another account!

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

    Why did you?

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

I hope that it does't be dynamic. How about you? Do you agree with me?

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

we want div.1 contests .

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

My last contest in summer! I'm going to school on Wednesday! Hope a good contest! Good Luck!

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

    but from your profile it looks like this will be your first contest.

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

      this will be My first contest but My last Summer contest , ok ?

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

        Oh My God :) , are You sure this contest your first contest? But I think this contest is your first contest by fake Account

»
9 years ago, # |
  Vote: I like it +94 Vote: I do not like it

I am no longer scared of fake contestants. If my rating goes down, its because I suck, and not because of anyone else.

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

Hello my friends ;)

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

Scoring will be 500-1000-1500-2000-2500?

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

In my whole country adsl is down. I'll be solving this contest on mobile net :)

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

750 points for div2 A :| from where that it cant be very nice i think it will be a long boring brute force :(

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

Why doesn't codeforces allow a little bigger hack files? There are solutions that will get time limit exceeded when the constraints are used but the files are bigger than 256 KB.

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

MLE on pretest 1 in D :(

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

What for the sake of God is wrong with pretest 9 Div 2 C?

Isn't it finding the longest non zero subsequence from an arbitrary vertex I with no childs?

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

    i believe there was situation when parent has larger index than a child

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

      Damn, should have thought about this. I shall try after the system testing.

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

        I don't know maybe my approach is wrong but I run DFS to see if we can reach at leaf without consecutive vertices's containing cat or not and add it to the result! But my code was failing on test case 8 and 9

        My code was failing on test case 8 This code http://paste.ubuntu.com/12523672/ and after swapping the index of the x and y when x > y My code failed on test case 9 http://paste.ubuntu.com/12523669/

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

          just add an extra line:

          adj[x].push_back(y);
          

          to:

          adj[x].push_back(y);
          adj[y].push_back(x);
          

          and I don't know what the if statment while reading really does!!

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

    My wrong assumption — If 1 is leaf, don't count it in answer. I kept counting it and kept getting failed submissions.

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

      How can 1 be leaf when 1 is root and n>2

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

        1-2 2-3 3-4 3-5

        1 is root and a leaf(in a way)

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

          How is 1 a lead in a way? I has 2 for a child

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

            Draw it on a paper, ad see for yourself. Clearly, assuming 1 to be leaf was wrong n this problem, but not in general, when the tree is unrooted. That's why it was failing.

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

              Leaf is a node with no child. 1 has a child 2. Seems like you got bit confused about leaf.

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

      How can 1 be leaf when 1 is root and n>=2

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

A lot of pretests, yet smooth system testing and no issues. Really nice contest.

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

How to solve E problem?

It was so interesting.

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

    I passed pretests with hashes + segment tree for updating hash value in a range.

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

    Segment + Hash

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

    I pass the pretests by compressing all values to bits.

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

      I thought about this and hashing also, but I couldn't figure out a way to check the query correctness except by iterating on each block and check if the hashes/bits equal.

      How to do this part quickly?

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

        String s[l, r] has period d if s[l, r-d] = s[l+d, r]. You can get the hash of a substring with a segment tree.

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

        I get TLE after system test. XD

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

        In my room, MrDindows successfully solve it by treating all character as long long. You can refer his code: http://codeforces.net/contest/580/submission/13165100

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

          Hey, can you explain his code. He is using memset and that is O(n) if I am not wrong. His solution seems to be O(n) per query.

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

            You can find many information about memset from Internet.

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

              Lets ignore the memset part. His query is still O(n).

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

                He do some thing to speed up the constant part of his algorithm such as treat character as long long and expand the while loop.

                I guess these changes of code will make CPU execute lesser command. (I'm not familiar with the detail, but I know these are common trick to speed up your code.)

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

      How to deal with cyclic dependcy in D ?

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

        Since the constraints are small, it can be solved by dp + bitmasks.

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

    Does anyone have any ideas how to solve Div2E without using hashing?

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

how to solve E ?

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

Pretest 9th for C ?

»
9 years ago, # |
  Vote: I like it +24 Vote: I do not like it

I was unable to submit in the last 60 seconds because codeforces was too busy. I hate it when that happens.

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

    And I was unable to hack in the last 60 seconds.

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

    Same here :/ I tried to hack in the last 20 seconds, but the challenge wasn't submitted.

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

    same as your problem :|

    solved D but It didn't submited, also in previous contests I have this problem too!!!

  • »
    »
    9 years ago, # ^ |
      Vote: I like it -18 Vote: I do not like it

    Блин решил последние две задачи а кодфорцез затупил и я не сумел послать(((((((((( уверен, это дело рук красных они бояться конкурентов и поэтому зажимают F5 на последних минутах и кодфорса ломаеца. предлагаю ограничивать красным доступ на сайт на время контестов.

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

I don't like problem scores!!! u think difference between problem C (or B) and D should be ONLY 500 (or 750).than it's same to solve A+B instead of D. May be my fault coz I solved only A,C,D(coz of not enough time),but anyway I don't think that this correct: man who solved first 3 problem is in front of me in list... D is much harder than A+B+C -_- sorry for my open mind

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

What's the problem with code generated tests ? I've got this one:

Validator 'valid.exe' returns exit code 3 [FAIL Expected EOLN (stdin)]

Thanks in advance.

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

    validator wants '\n' in the end of a test.

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

      Check this out.

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

        Your test has extra space

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

        Error: space is in the end of the second line.

        It's correct:

        for (int i = 0; i < 100000; ++i) {
          printf("%d", i + 1);
          if (i + 1 != 100000)
             printf(" ");
        }
        
      • »
        »
        »
        »
        9 years ago, # ^ |
        Rev. 3   Vote: I like it 0 Vote: I do not like it

        Thanks, guys. That's just hilarious ;-(.

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

Is there anything need to pay attention to in the C problem? I failed to pass the 8th test and i can't find any mistakes.

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

    Me too. :(

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

      I just see the test data and I found it was because I wrongly think xi and yi in input mean xi is yi's father node.

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

    You assumed given graph(tree) to be directed.

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

Can someone suggest an approach for 2nd? I basically sorted the friends based on their money, and I was then going to group friends based on the condition and sum their friendship factor, and check which group has the most. Is there a better way to do it? or any flaw in my solution.

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

    you can read about the two pointer technique , and try solving the problem.

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

    Firstly,sort the friends based on their money.Then,enumerate every element in array and use the function "lower_bound" to find the first element which is bigger than the it.And use the sum of factor between the two element to update your answer

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

    1) sort based on money

    2) find prefix sums for friendship factors

    3) for i=1 to n
    a) use any O(log n) mechanism to find index j such that money[j]>=money[i]+d ... I used c++ map for this.
    b) ans = max (ans,prefix_sum[j-1]-prefix_sum[i-1])

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

      I had the same solution. Used std::lower_bound(a + i, a + n, a[i] + d) to find the least index ahead of i which I can not select, if I select i.

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

      Index j is also invalid so why are you doing prefix_sum[j-1] and not prefix_sum[j] ?

      Am assuming that i > j as we are considering the ith element and the old set if in [0..i-1]

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

        Assume your set starts from i. We have sorted in ascending order of money so j>i because j is the lowest index you need to exclude if the set starts from i such that money[j]>=money[i] + d ... you can set money [n+1] = INF ... Include all elements from i to j-1 in current set and to get the sum of friendship factors of such ranges/sets of in O(1), I pre-calculated prefix sums. To get sum of elements from i to j-1, you need to subtract prefix[i-1] from prefix[j-1].

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

Can someone explain D soln ?

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

    I solved it by DP, take a d[n][2^n] array,where d[i][j] means what is the best answer when last dish is i and j represents which dish I tasted before it,(1 means tasted,0 not tasted)

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

    dp[mask][j] — best answer if we finish eating at j — dish, and ate all dishes in mask. O(n^2 * 2^n)

  • »
    »
    9 years ago, # ^ |
    Rev. 3   Vote: I like it -15 Vote: I do not like it

    constrains of n & m are small. I think it can be solved using recursion trying all possible ways.

    UPD: it will pass only by using memoization..

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

    Well, I think it is almost the same as the Traveling Salesman Problem

    You have a graph, where the dishes are the nodes and the eating rules are the edges

    dp[y][bit_mask]:

    y is the last node you visited (dish you ate)

    bit_mask is bit mask in which if the Nth bit is set it means that somewhere along the path you visited node N (ate dish N)

    so

    dp[y][bit_mask] = max (dp[x][bit_mask — (1 << y)] + eating_rule[x][y] + a[y])

    if there isn't a eating rule between x and y than eating_rule[x][y] should be zero

    so your final answer is the best dp[y][bit_mask] where bit_mask contains exactly M ones

    you have N * 2 ^ N states and the you need O(N) for each, so total complexity is O (N^2 * 2^N)

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

Went out and could not fully participate in contest. Too bad!!!.

My thinking of how to solve Div2 B.(not sure if its correct)

  1. Sort set S by amount.

Suppose we have <n=k people already to be a company. They are K-1 of them in number.

Consider the Kth person.

Case 1 : He should be in company. This is only possible if this amount is a < S[0].a That is it is smaller than the amount of the smallest person in the group.

Case 2: His amount is bigger.

In this case, we can use binary search to find a range of numbers that conflict with the Kth person, we sum the total factors of this said group.

We have to choose between the whole group and the Kth person. Which ever increases the overall amount.

Please would this have solved the problem???

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

    I got AC using this approach

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

      OMG!!!, I can't believe i just threw away my chance of turning blue today. Oh well, i'm happy i got the approach at least. Lets wait for the next round.

      Thanks for the reply Expert Katalonecfly.

»
9 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Can't wait to see the rating change!!!

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

were the test case for 2nd question weak because i used upper_bound instead of lower_bound in hurry and i got AC? :P

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

    I used upper_bound in one failed submission. You're lucky :)

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

      I know why it passed coz i upper_bound on make_pair(curr+d,0). If instead of 0 it would have been a greater value it would not have passed. Yes I was lucky, coz i did not see that through.

      PS : the test cases weren't weak then i guess.

      • »
        »
        »
        »
        9 years ago, # ^ |
        Rev. 2   Vote: I like it -13 Vote: I do not like it

        The test cases were not weak, but solutions that did not consider test cases similar to yours passed. Overall, the solution is still correct and adding these test cases would've made the problem unnecessarily tricky.

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

I have this idea for D. Please tell me if you find something wrong in it.

  1. Use bitmask to find numbers with m set bits.
  2. From the k-rule directed tree, form a directed sub-tree which has only the vertices identified in step 1. Add their individual satisfaction values.
  3. Start from leaf nodes. Push them in a queue. Pop only if all children of the vertex have been popped. This way, do a Comparison for every non-leaf vertex to pick the child path that gives maximum satisfaction. So, along with all child-path satisfaction values, you add only 1 extra value for joining vertex v to its max satisfaction child.

Is it correct to start from leaf nodes?

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

    I don't know if it's correct but it's an overkill.

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

      Ok ;_; . I'll look at the editorial then.

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

        It is dp with masks. State is last eaten and bitmask of eaten so far. To solve a state you try to fix the next to be eaten.

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

Oh my god, i have disastrous bugs :'( i will cry in the bathroom.

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

I assumed that input was (parent, child) on C!!! ... silly mistake.

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

I agree with everything above and confirm that I will provide my own problems

Just a quote regarding D.

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

How can we solve problem B if every friend was associated with hia own value of 'd', the value that makes him feel poor.

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

Nice problem ( E — Kefa and Watch ). I found a solution using hashing + segment tree, but couldn't solve it in time. BTW is there any solution without using hashing?

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

kuldeepfouzdar nice trick for Unsuccessful hacking attempts on your solution, in the problem B:

#define int long long

http://codeforces.net/contest/580/submission/13163755

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

Hello all,

I have a question about an unsuccessful hack that I did during the contest. I hacked the following submission as I noticed that the numbers of the sequence are stored in indices of an array starting from 1 to n. The array is of size n and hence I expected that the hack will result in run time error due to the index overflow for a large input where the size of the sequence is 10^5.

Can anybody explain to me why did the hack fail? I expect it might have something to do with the unused array f but I am not sure about it.

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

    C++ doesn't have index overflow run time errors, all that happens is that it accesses memory outside the array and as long as said memory is not used for something else it will pass.

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

How come 300 div2 participants managed to solve D? In my opinion it was a pretty hard dynamic programming problem.

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

    Really ? I think that's the basic form of bitmask dynamic programming though

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

      Basic bitmask would not have arbitrary transition rules, most in div 2 fails at problems like this. I think its strange that it was solved by as many div 2 participants as this problem which is much easier:

      http://codeforces.net/contest/574/problem/D

      This problem is also easier and was solved by just 100 div 2 participants:

      http://codeforces.net/problemset/problem/540/D

      So I'm just wondering: what makes this problem easy?

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

        Rather than "easier", I would say it is more well known

        IMO, one of the most basic problem for bitmask DP is finding shortest path to travel through all vertices in the graph which is completely the same as 574D, except that the answer lie only in status 2^n - 1

        P/s : this is the first bitmask DP problem I learned so it can be just me

        UPD: I've seen some tutorials about bitmask DP (just google search, you'll find them) use above problem as sample to solve so it should be well known

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

          Ah, I see! Thanks! I had just seen it for things like edit distance and knapsack and those are way easier.

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

    Future div1 participiant ;)

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

      Good job, there is no way I could have solved that when I was in div 2!

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

Stand-up contest)

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

Really nice contest, can't wait for your next one.

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

When will the solutions be uploaded?

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

so many O(m(n+k)) solutions passed E 13198157

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

In Problem B, I think it should be "Print the maximum total friendship factor that can be reached." in the Output statement.