By Vladik, 3 years ago, translation, ,

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 Dmitry_Aksenik(Dmitry Aksenik) and RevtIvan(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!

•
• +191
•

 » 3 years ago, # |   +20 3..2..1..Go!
 » 3 years ago, # | ← Rev. 2 →   -11 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.
•  » » 3 years ago, # ^ |   +8 I'm sure they will all be pleased if the round goes well :)
•  » » » 3 years ago, # ^ |   +8 I assume gamamal tried to go for an obvious innuendo. I learn more about CF community every day.
•  » » » » 3 years ago, # ^ | ← Rev. 2 →   0 In part I wanted to point out they made an English mistake, swapping "Thank" for "Please".
 » 3 years ago, # |   -7 Why no div1 :/
 » 3 years ago, # |   0 And in the hope ... that i shall get some hacks :D GL & HF :)
 » 3 years ago, # | ← Rev. 3 →   +27 Oh it will be a magical round. P.S : Please see the tags.
•  » » 3 years ago, # ^ |   0 And it's also a magical number of the round (321).
•  » » 3 years ago, # ^ |   -16 Tagsesh chie baz!!!
 » 3 years ago, # | ← Rev. 3 →   +13 thanks for magical contest about parrot KEFA)
 » 3 years ago, # |   +5 Do you mean Kefa ?
 » 3 years ago, # |   0 i just want raising rating .......
•  » » 3 years ago, # ^ |   0 And also joy and benefit my dear ;)
•  » » 3 years ago, # ^ |   +21 Unfortunately, the probability of all users get raising rating is zero :(
 » 3 years ago, # |   -16 hope to see hard math problems :)
•  » » 3 years ago, # ^ |   +7 Maths problems is sometimes interesting(brainstorm). But too many maths problems will make my brain feel tired.
•  » » » 3 years ago, # ^ |   -9 It's just two hours :)
•  » » 3 years ago, # ^ |   -14 Занимаешся футболом и любишь матиматические задачки????Страный ты однака...
•  » » » 3 years ago, # ^ |   +6 i agree
•  » » » » 3 years ago, # ^ |   -9 i too
 » 3 years ago, # |   +16 Div. 1 guys do not make new accounts please. :)
•  » » 3 years ago, # ^ |   -14 Toooo_Simple
•  » » 3 years ago, # ^ |   +37 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!
•  » » 3 years ago, # ^ |   0 Why did you?
•  » » » 3 years ago, # ^ |   0 The one who is doing that is a retarded person!
 » 3 years ago, # | ← Rev. 2 →   0 I hope that it does't be dynamic. How about you? Do you agree with me?
 » 3 years ago, # |   -8 we want div.1 contests .
•  » » 3 years ago, # ^ |   0 :|
 » 3 years ago, # | ← Rev. 2 →   +2 My last contest in summer! I'm going to school on Wednesday! Hope a good contest! Good Luck!
•  » » 3 years ago, # ^ |   +8 but from your profile it looks like this will be your first contest.
•  » » » 3 years ago, # ^ |   0 this will be My first contest but My last Summer contest , ok ?
•  » » » » 3 years ago, # ^ |   +8 Oh My God :) , are You sure this contest your first contest? But I think this contest is your first contest by fake Account
 » 3 years ago, # |   +94 I am no longer scared of fake contestants. If my rating goes down, its because I suck, and not because of anyone else.
•  » » 3 years ago, # ^ |   +28 Yes the sucker man!!!
•  » » » 3 years ago, # ^ |   +7 Lol
•  » » 3 years ago, # ^ |   0 Get better than their main accounts and take their real rating as revenge!
 » 3 years ago, # | ← Rev. 2 →   -20 Hello my friends ;)
•  » » 3 years ago, # ^ |   +13 Check the 1st version of his comment . He called everyone b*****s >_<
•  » » » 3 years ago, # ^ | ← Rev. 2 →   -23 It was just a typo my friend ;)
•  » » » » 3 years ago, # ^ |   +18 Ugh!!! Don't you just hate it when you write "friends" and codeforces autocorrect changes it to "b*****s" ? :p
 » 3 years ago, # |   0 Scoring will be 500-1000-1500-2000-2500?
•  » » 3 years ago, # ^ |   +6 no
 » 3 years ago, # |   +8 In my whole country adsl is down. I'll be solving this contest on mobile net :)
 » 3 years ago, # |   +3 750 points for div2 A :| from where that it cant be very nice i think it will be a long boring brute force :(
•  » » 3 years ago, # ^ |   0 This can also mean difficulty of A,B,C is not necessarily in that order.
 » 3 years ago, # |   +1 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.
•  » » 3 years ago, # ^ |   +1 You must write a test generator
•  » » » 3 years ago, # ^ |   0 There's only field for writing the test case, right?
•  » » 3 years ago, # ^ |   +1 In such case, you should write test-case generator.
 » 3 years ago, # |   0 my best contest eve :D I_love_321_&_taylor_&_hiro_hamda
 » 3 years ago, # |   0 MLE on pretest 1 in D :(
 » 3 years ago, # | ← Rev. 4 →   +1 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?
•  » » 3 years ago, # ^ |   0 i believe there was situation when parent has larger index than a child
•  » » » 3 years ago, # ^ |   0 Damn, should have thought about this. I shall try after the system testing.
•  » » » » 3 years ago, # ^ |   0 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 9My 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/
•  » » » » » 3 years ago, # ^ |   0 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!!
•  » » 3 years ago, # ^ |   0 My wrong assumption — If 1 is leaf, don't count it in answer. I kept counting it and kept getting failed submissions.
•  » » » 3 years ago, # ^ |   0 How can 1 be leaf when 1 is root and n>2
•  » » » » 3 years ago, # ^ |   +3 1-2 2-3 3-4 3-51 is root and a leaf(in a way)
•  » » » » » 3 years ago, # ^ |   0 How is 1 a lead in a way? I has 2 for a child
•  » » » » » » 3 years ago, # ^ |   +3 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.
•  » » » » » » » 3 years ago, # ^ |   0 Leaf is a node with no child. 1 has a child 2. Seems like you got bit confused about leaf.
•  » » » » » » » » 3 years ago, # ^ |   +1 I suppose yes. I used the condition 'only 1 adjacent node' to identify leaf.
•  » » » 3 years ago, # ^ |   0 How can 1 be leaf when 1 is root and n>=2
•  » » 3 years ago, # ^ |   0 I had WA on pretest 8.
 » 3 years ago, # |   +8 A lot of pretests, yet smooth system testing and no issues. Really nice contest.
 » 3 years ago, # |   0 How to solve E problem?It was so interesting.
•  » » 3 years ago, # ^ |   +5 I passed pretests with hashes + segment tree for updating hash value in a range.
•  » » 3 years ago, # ^ |   +8 Segment + Hash
•  » » 3 years ago, # ^ | ← Rev. 2 →   0 I pass the pretests by compressing all values to bits.
•  » » » 3 years ago, # ^ |   0 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?
•  » » » » 3 years ago, # ^ |   +29 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.
•  » » » » » 3 years ago, # ^ |   +5 I feel so stupid right now ._.
•  » » » » » 3 years ago, # ^ |   +11 That's brilliant, I've never seen this trick before.
•  » » » » » 3 years ago, # ^ | ← Rev. 3 →   -8 Except when d = r — l + 1. Nice observation though :)
•  » » » » 3 years ago, # ^ |   +21 I get TLE after system test. XD
•  » » » » 3 years ago, # ^ |   0 In my room, MrDindows successfully solve it by treating all character as long long. You can refer his code: http://codeforces.com/contest/580/submission/13165100
•  » » » » » 3 years ago, # ^ |   0 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.
•  » » » » » » 3 years ago, # ^ |   0 You can find many information about memset from Internet.
•  » » » » » » » 3 years ago, # ^ |   0 Lets ignore the memset part. His query is still O(n).
•  » » » » » » » » 3 years ago, # ^ |   0 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.)
•  » » » 3 years ago, # ^ |   0 How to deal with cyclic dependcy in D ?
•  » » » » 3 years ago, # ^ |   0 Since the constraints are small, it can be solved by dp + bitmasks.
•  » » 3 years ago, # ^ |   0 Does anyone have any ideas how to solve Div2E without using hashing?
•  » » » 3 years ago, # ^ | ← Rev. 4 →   +1 Ignore... It's wrong.
•  » » » » 3 years ago, # ^ | ← Rev. 3 →   +8 Why lcm(nextk1, \$next_{k2}Unable to parse markup [type=CF_TEX]) | d ?What do your ki means?
•  » » » » » 3 years ago, # ^ |   0 Sorry, I just figured out it's wrong.
 » 3 years ago, # |   0 how to solve E ?
 » 3 years ago, # |   0 Pretest 9th for C ?
•  » » 3 years ago, # ^ |   0
 » 3 years ago, # |   +24 I was unable to submit in the last 60 seconds because codeforces was too busy. I hate it when that happens.
•  » » 3 years ago, # ^ |   0 And I was unable to hack in the last 60 seconds.
•  » » 3 years ago, # ^ |   0 Same here :/ I tried to hack in the last 20 seconds, but the challenge wasn't submitted.
•  » » 3 years ago, # ^ | ← Rev. 3 →   +3 same as your problem :|solved D but It didn't submited, also in previous contests I have this problem too!!!
•  » » » 3 years ago, # ^ |   +1 same here...
•  » » 3 years ago, # ^ |   -18 Блин решил последние две задачи а кодфорцез затупил и я не сумел послать(((((((((( уверен, это дело рук красных они бояться конкурентов и поэтому зажимают F5 на последних минутах и кодфорса ломаеца. предлагаю ограничивать красным доступ на сайт на время контестов.
 » 3 years ago, # | ← Rev. 2 →   +2 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
 » 3 years ago, # |   0 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.
•  » » 3 years ago, # ^ |   0 validator wants '\n' in the end of a test.
•  » » » 3 years ago, # ^ |   0 Check this out.
•  » » » » 3 years ago, # ^ |   0 Your test has extra space
•  » » » » 3 years ago, # ^ |   0 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(" "); } 
•  » » » » 3 years ago, # ^ | ← Rev. 3 →   0 Thanks, guys. That's just hilarious ;-(.
 » 3 years ago, # |   0 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.
•  » » 3 years ago, # ^ |   0 Me too. :(
•  » » » 3 years ago, # ^ |   0 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.
•  » » 3 years ago, # ^ |   0 You assumed given graph(tree) to be directed.
 » 3 years ago, # |   0 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.
•  » » 3 years ago, # ^ |   0 Even I did the same ... KC3 hacked my solution.
•  » » » 3 years ago, # ^ |   0 It was a TLE. Used Binary Search but did not store the factor sum values. took the sum linearly everytime.TLE. haha.
•  » » 3 years ago, # ^ | ← Rev. 3 →   0 you can read about the two pointer technique , and try solving the problem.
•  » » 3 years ago, # ^ |   0 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
•  » » 3 years ago, # ^ | ← Rev. 3 →   0 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])
•  » » » 3 years ago, # ^ |   +3 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.
•  » » » 3 years ago, # ^ |   0 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]
•  » » » » 3 years ago, # ^ |   0 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].
•  » » » 17 months ago, # ^ |   0 thank you ..
•  » » 3 years ago, # ^ | ← Rev. 2 →   +1
•  » » 3 years ago, # ^ |   0 I used Two Pointers + Partial Sums. O(nlogn) http://codeforces.com/contest/580/submission/13170675
 » 3 years ago, # |   0 Can someone explain D soln ?
•  » » 3 years ago, # ^ |   0 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)
•  » » 3 years ago, # ^ |   0 dp[mask][j] — best answer if we finish eating at j — dish, and ate all dishes in mask. O(n^2 * 2^n)
•  » » 3 years ago, # ^ | ← Rev. 3 →   -15 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..
•  » » » 3 years ago, # ^ | ← Rev. 2 →   0 That would be about N!-(N-M)!, which is too much.
•  » » » 3 years ago, # ^ |   0 Aren't all possible cases O( P(n,m) ) ? (Which should be too high for recursion)
•  » » » 3 years ago, # ^ | ← Rev. 3 →   0 I'm sorry for this. I updated it. and here's my solution: http://codeforces.com/contest/580/submission/13170384
•  » » 3 years ago, # ^ |   +2 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 edgesdp[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 zeroso your final answer is the best dp[y][bit_mask] where bit_mask contains exactly M onesyou have N * 2 ^ N states and the you need O(N) for each, so total complexity is O (N^2 * 2^N)
•  » » » 3 years ago, # ^ |   +5 Used same idea, got AC in Practice. Link to Code
 » 3 years ago, # |   +1 Went out and could not fully participate in contest. Too bad!!!.My thinking of how to solve Div2 B.(not sure if its correct) Sort set S by amount. Suppose we have
•  » » 3 years ago, # ^ |   0 I got AC using this approach
•  » » » 3 years ago, # ^ |   +2 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.
 » 3 years ago, # |   0 Can anyone explain me why this 13153912 got hacked?
•  » » 3 years ago, # ^ |   0 Oh got it TLE. :(
 » 3 years ago, # |   +2 Can't wait to see the rating change!!!
•  » » 3 years ago, # ^ |   +23
•  » » » 3 years ago, # ^ |   0 good picture
 » 3 years ago, # |   0 were the test case for 2nd question weak because i used upper_bound instead of lower_bound in hurry and i got AC? :P
•  » » 3 years ago, # ^ |   0 I used upper_bound in one failed submission. You're lucky :)
•  » » » 3 years ago, # ^ |   +8 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.
•  » » » » 3 years ago, # ^ | ← Rev. 2 →   -13 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.
 » 3 years ago, # |   0 I have this idea for D. Please tell me if you find something wrong in it. Use bitmask to find numbers with m set bits. 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. 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?
•  » » 3 years ago, # ^ |   +3 I don't know if it's correct but it's an overkill.
•  » » » 3 years ago, # ^ |   0 Ok ;_; . I'll look at the editorial then.
•  » » » » 3 years ago, # ^ |   +2 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.
 » 3 years ago, # |   0 What's the Problem With my Code?? http://codeforces.com/contest/580/submission/13165400
 » 3 years ago, # |   +1 Oh my god, i have disastrous bugs :'( i will cry in the bathroom.
 » 3 years ago, # |   0 I assumed that input was (parent, child) on C!!! ... silly mistake.
 » 3 years ago, # |   0 I agree with everything above and confirm that I will provide my own problemsJust a quote regarding D.
 » 3 years ago, # |   +1 How can we solve problem B if every friend was associated with hia own value of 'd', the value that makes him feel poor.
•  » » 3 years ago, # ^ |   +3 Sort + fast search algorithm.
•  » » 3 years ago, # ^ |   0
•  » » 3 years ago, # ^ | ← Rev. 2 →   0 So if you fix a[i] as being the biggest of sums,you need to add all a[j]a[i].This can be done with fenwick tree,at position a[j]+d[j] you add factor[j].And for i the answer is query per range [a[i]+1,limit]
•  » » 3 years ago, # ^ | ← Rev. 2 →   0 Or linear parsing, with two pointershttp://codeforces.com/contest/580/submission/13150523
 » 3 years ago, # |   +16 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?
 » 3 years ago, # |   0 In problem C, I'm having a bit of a problem determining the leaves of the tree.Assuming the tree is directed, In pretest 9, there are edge connections from 9 vertices to other ones and the answer is 7. So apparently there are 7 leaves. A lot of the people have considered an undirected graph. How do I find the leaves? I keep failing on pretest 9
•  » » 3 years ago, # ^ | ← Rev. 3 →   0 Leaves can have only one node in their adjacency list. And when you do dfs (starting from the root of the tree, which is always node №1), this only node must be already marked as visited.
•  » » » 3 years ago, # ^ |   0 Yes I did that and it passed (BFS). Also, in contrast to the above comments, 1 will NOT be taken as a leaf in any case. If you do, you fail on pretest 3 atleast acc to my logic.
 » 3 years ago, # | ← Rev. 2 →   +19 kuldeepfouzdar nice trick for Unsuccessful hacking attempts on your solution, in the problem B:#define int long longhttp://codeforces.com/contest/580/submission/13163755
 » 3 years ago, # |   0 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.
•  » » 3 years ago, # ^ |   0 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.
 » 3 years ago, # |   +1 How come 300 div2 participants managed to solve D? In my opinion it was a pretty hard dynamic programming problem.
•  » » 3 years ago, # ^ | ← Rev. 2 →   +35 Really ? I think that's the basic form of bitmask dynamic programming though
•  » » » 3 years ago, # ^ | ← Rev. 6 →   +1 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.com/contest/574/problem/DThis problem is also easier and was solved by just 100 div 2 participants:http://codeforces.com/problemset/problem/540/DSo I'm just wondering: what makes this problem easy?
•  » » » » 3 years ago, # ^ | ← Rev. 4 →   +7 Rather than "easier", I would say it is more well knownIMO, 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 - 1P/s : this is the first bitmask DP problem I learned so it can be just meUPD: 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
•  » » » » » 3 years ago, # ^ |   0 Ah, I see! Thanks! I had just seen it for things like edit distance and knapsack and those are way easier.
•  » » 3 years ago, # ^ |   0 Future div1 participiant ;)
•  » » » 3 years ago, # ^ |   0 Good job, there is no way I could have solved that when I was in div 2!
 » 3 years ago, # |   +3 Stand-up contest)
 » 3 years ago, # |   +1 Really nice contest, can't wait for your next one.
 » 3 years ago, # |   0 When will the solutions be uploaded?
•  » » 3 years ago, # ^ |   0 There are solutions in the editorial=)
 » 3 years ago, # | ← Rev. 4 →   +11 so many O(m(n+k)) solutions passed E 13198157
 » 3 years ago, # |   0 Hello! Has somebody managed to get AC for problem D, using reccursion? I can't. I get tle on test 26 :(.
 » 3 years ago, # |   0 In Problem B, I think it should be "Print the maximum total friendship factor that can be reached." in the Output statement.