By BledDest, history, 7 years ago, In English

Hello Codeforces!

On September 21, 18:05 MSK Educational Codeforces Round 29 will start.

Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.

The round will be unrated for all users and will be held on extented ACM ICPC rules. After the end of the contest you will have one day to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 7 problems and 2 hours to solve them.

The problems were prepared by Mikhail awoo Piklyaev, Mikhail MikeMirzayanov Mirzayanov, Vladimir vovuh Petrov and me.

Good luck to all participants!

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

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

For a joke, How to solve the terrible problem A?

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

    As what I said, HOW TO SOLVE THE TERRIBLE PROBLEM B??

    My idea is: priority_queue make all the value of (abs(w[a]-w[b]) (1<=a,b<=2*n,a!=b)) into the queue, and choose the national w[a] — w[b], then the (n-1) pair of (w[a] — w[b])'s sum is my answer

    Is'it something wrong with my idea? I need all of your help,thanks!

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

      You have n*(n-1)/2 ways to pick single guys. So for every combination calculate new value and take the minimum.

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

      There is open-hacking for 24 hours, please don't discuss problems before this phase ends.

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

        i think we should discuss the problems because we can get more ideas for hacks. It is not rated anyways,so i don't see any problems

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

      The idea is wrong.because the value “a” or “b” will be chosen more than once. However,a man only belongs to one ship. In fact,we should try to pick two people out and do not consider them. Now we have 2n-2 people.we sort the array by weight. After sorting .the answer is the sum of whose index is even plus the sum of whose index is odd.

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

        But i marked both whose diff is minimum...but still showing error...?? as shown: (a[i]-a[j],{i,j})

        if(!(vis[i] || vis[j]) ans+=a[i]-a[j]

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

          Maybe you should try to think about this example. N = 3 1 5 6 20 1000 2000 And ans should be 18

          Your output is 20?

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

            TvT...I should first choose two single.And choose double two by two, Igot it now, thank you!

»
7 years ago, # |
  Vote: I like it +167 Vote: I do not like it

uwi be like :

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

    If uwi is in hacking mode, we will not need system testing after the round.

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

Another ROUND!!!!where u can relax about Rating.The more u dont want to care about ratings the more u start to care....Why rating is so cruel!!!!!!!!!!!

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

Is it rated?

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

    No, the Educational Codeforces Round is based on ACM rules, so it is unrated.

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

      Pardon me, but how do those two go together?

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

        All the rated rounds are based on Codeforces rules, so if the round isn't based on Codeforces rules, it's often unrated.(Maybe I was wrong,it is unrated just because it's an Educational round).

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

This question is for uwi and halyavin.

Just out of curiosity, hacking solutions is a way to learn something new or you guys just pass your free time by hacking hundreds of solutions in Educational rounds ?

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

    not much time needed, it's probably a script that automatically download source code , compile and run it , they only need good hacking tests , or if you feel lazy just randomly generate some tests and compare the output to a non hackable solution ,you can check TLE/RE errors too.

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

      That's a legend thinking approach !

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

      Wait, I never realised you can download solutions in text form during educational rounds! Well, well, well...

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

    I do learn new things while trying to hack solutions. This type of thinking helped me to construct the worst test case for my own contest problem recently.

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

I need to check the rules of ACM-ICPC. Can anybody send the link?

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

i hope someday , somebody write a contest about DOTA 2 it would be so nice :D

»
7 years ago, # |
  Vote: I like it +60 Vote: I do not like it

Getting Hired.. uwi mode

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

When is this and is it rated?

»
7 years ago, # |
  Vote: I like it +14 Vote: I do not like it

Hi , This will be my first Codeforces contest !

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

    please don't bomb the contest, we beg you, it's only educational to serve the country...

    Please someone tell uwi to not hack this guys

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

    You are DED

»
7 years ago, # |
  Vote: I like it +22 Vote: I do not like it

The days are gone forever when our enemies could blackmail us with nuclear bombs.

»
7 years ago, # |
  Vote: I like it +10 Vote: I do not like it

Time to BOMB test case #3 of Problem B

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

    You are behaving very badly, Rocket Man.

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

      We will have no choice but to totally destroy the problemset!

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

    you can pass it and get ac if you add one line

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

Test 14 in E?

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

What is test 14 in E?

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

    If you are compressing the values, you should add (r[e] + 1) to the values to compress, at least I did this and passed

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

      Can we solve that questions using Compression and BIT ???

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

        I probably wrong , but i don't think so, we can't get the minimum of a range with BIT and do range updates at the same time.

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

        My solution is:
        suppose the elements l[e], r[e] <= 105
        If you add 1 to every element in the range [l[e], r[e]] for every e , you can check if a range is good checking if the minimum element in the range is 1.
        Because if the minimum is 1 after deleting that range we gonna have at least a 0, what means that the number of moments increased.

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

      Any reason why compression with l[i],r[i],l[i]-1,r[i]+1 works?

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

        Basically, you have to see that some number may be 'lost', what I mean is that when we are compressing we are not considering the elements l[e] < X < r[e], for every e, so we can create a case were there is more that an range loses one of it's elements and after this our algorithm gives the wrong answer, but actually we don't have to take exactly all the X, if this situation gonna happen is because of there is two ranges with some intersection, so the values that matters are the borders of the ranges, it's not a good answer, but if it's not clear I can try to explain in a better way

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

    this is a test like it

    3

    1 3

    5 7

    2 6

    correct answer:-1

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

How to solve E? (and why i'm getting RTE with a simple segtree?)

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

    the seg tree dimenison is too little,it should be 4*2*MAXN

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

      Oh, i see, thank you :)

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

      I tried to solve it using segment tree with range sum updates and range min query first i do coordinate compression and then i will update from 1 to n all queries with +1 to their corresponding range and then i will start from 1 to n and at an i th position i will remove that update by adding -1 to that range and check if in that range iam getting any 0 if NO THEN that is a valid ans as it is not affecting others's //(using range min query ) but the problem is i was unable to implement it in time .and also can't we implement a segment tree with range sum updates and range min queries??

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

        You don't need range min queries. What you need to know — is there any element on range equal to 1. Just access each element of your tree and build an array of prefix sums with amount of 1's on prefix, like this: prefixSum[i] = prefixSum[i-1] + (tree.get(i)==1). Then some segment [l; r] is an answer if prefixSum[r] - prefixSum[l-1] == 0

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

          tnx , cool idea to solve that question(we don't even need a segment tree we can use partial sum trick ) . btw i have a doubt in general not regarding this question but can we code a segment tree with lazy propagation such that we can do range sum updates (i.e we can add a value v from l to r ) and we can do range min queries (i.e we can find minimum in that range from l to r ) in logN time .

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

I tried to solve D using treap, I think it is an overkill but it should work! I got RE on test 10 and 11 ... it's weird

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

    I'm not sure, but it might be because you put the priorities as rand () (up to 32000 on CF compiler). If you extended the set of possible values, the possibility of two priorities being equal on adjacent positions (which most treap implementations consider 0) would dramatically decrease. I use treaps with rotations and in that implementation in function erase, if you have two neighboring nodes having the same priority and do not pay special attention to the case, you might end up with a loop. Let alone that such small values cut off the idea of normal distribution, so even if you hadn't gotten RE, you would've gotten TLE. Try to switch that line of the code with something like p = (rand () << 15) + rand ().

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

      You are right! It worked. I completely forgot about that detail.

      I must say, I have been very lucky because I have always used just "rand()" in these kind of problems.

      Thanks!!

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

    Actually, I did the same overkill :)

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

    How can you reverse the segment using treap?

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

      Each node should contain a bit which indicates whether you need to flip it or not. To flip a segment, split the treap into three parts (propagating the flips as needed), change the flip bit on the middle part, and then merge the parts.

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

      Another approach is to build two treaps. One for the initial array and another for the reversed array. If you have to reverse a segment you swap the corresponding segments in these treaps.

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

very interesting problemset.

»
7 years ago, # |
  Vote: I like it +20 Vote: I do not like it

I laughed so hard when I saw SPFA_THE_BEST_ALGORITHM's nickname, knowing it is part of the solution to problem F :D

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

Simple solution to problem E, no data structures needed (other than array) 30592259

PS: I hope nobody hacks it !

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

    just found a little hack, if you fix it I would try again, although the solution approach seems kinda correct to me :)

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

      Sure ill try to fix it later (order needs to be x increasing then y decreasing), i also believe it to be a correct approach, but i seem to be unable to code without bugs lately.

      Edit: fixed version, with the change previously described 30727493

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

Is there solution for D easier than treap solution?

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

    Do the operation backwards. For every b, do the operations in reverse to find where the number would have started. Then print that number. Complexity is O(m * q).

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

Hi guys, I did join this website yesterday. and I am really happy for this. Few minutes ago I did submit my attempt to solve the problem A but I see runtime error on test1.

I am quasi sure that my solution is working well. I did use java. should I stop using things like demanding the user to enter an input "java.util.Scanner" ? please help me!

The solution is bellow :

package javaapplication7;
import java.util.Scanner;
public class JavaApplication7 {
    public static void main(String[] args) {
        //Reading user's number and adding leading zeros 
        Scanner s = new Scanner(System.in);
        System.out.println("Enter the number please");
        Long in = s.nextLong();
        String in_to_str = in+"";
                
        int in_last_index = in_to_str.length()-1;
        String sub_str_to_add = "";
        while(in_to_str.charAt(in_last_index)=='0'){
            sub_str_to_add=sub_str_to_add+"0";
            in_last_index--;
        }
        in_to_str = sub_str_to_add + in_to_str;
       
        //testing whether it's a palindromic or NOT
        int in_len = in_to_str.length();
        int ind_diff=-1;
        for (int start=0,end=in_len-1;start<in_len/2&&end>in_len/2;end--,start++){
            if(in_to_str.charAt(start)!=in_to_str.charAt(end))
            {
                ind_diff = start;
                break; 
            }       
        }
           
        /* the second part of the if condition [in_len==2&&in_to_str.charAt(0)!=in_to_str.charAt(1)] 
        is to treat the case of a number composed of two digits which is not included in the previous test */
        if(ind_diff<in_len/2&&ind_diff!=-1||in_len==2&&in_to_str.charAt(0)!=in_to_str.charAt(1))
        System.out.println("The number "+in+" is NOT quasi-palindromic");
        else 
        System.out.println("The number "+in+" is quasi-palindromic");            
    }   
}

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

    Remove "System.out.println("Enter the number please");" and see if it goes away

    Also you are supposed to output only "YES" or "NO".

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

how should i approach problem E? Thank you.

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

    Create a map m which will compress the indices. The interval [l, r] will be transformed to m[l], m[r + 1] - 1. Now either

    • Use a lazy segment tree to add to a range and query the minimum along a range. A TV is redundant iff the minimum number of TV's at any integer point in time from l to r inclusive is greater than 1. This works well if you already have a template prepared. :)
    • Create a cumulative sum table, which will allow you to determine all points in time where exactly 1 TV is working. Now for each TV you can query if any of these points are inside [l, r] with a set. If none of them are inside, then this TV is redundant.
    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      There is a simplier solution without indices compression and segment tree:

      The main idea, that TV (l, r segment) is redundant if it fully overlapped by one or two consecutive segments (proof is pretty easy). So algorithm looks like:

      1. Sort all segments in ascending order of r (for equal r in desc order of l)
      2. Iterates over segments, lets look to the set of the segments that already viewed and pick segment with maxL, and segment with maxR (this segments must be different), so segment with max L is redundant only if it overlapped by current segment or by current segment & segment with maxR.

      30588470

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

      Can you please explain why indices left — 1 and right + 1 are compressed along with left and right?

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

      I followed the exact same approach but somehow I'm getting a WA. I have used a BIT for the cumulative sum. Getting WA on 16th test case. Here is a link to the code. https://code.hackerearth.com/0ec204e?key=4b7fb07878fac98d3c5bcc41899f3436

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

Hey! I am new to codeforces. Can anyone guide me ?

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

    Start solving problemset starting from Div II A, B. Learn some algorithms and DS and then jump to Div I. Participating in contests is a must. Read other people's solutions and be most important be optimistic.

»
7 years ago, # |
  Vote: I like it +36 Vote: I do not like it

Because hacking others' solutions is too mainstream.

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

How to solve the problem D?I have no idea on data structure,could someone give me a little help?

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

    Consider the number of queries is smaller in 100, we can calculate for every single query for the operations but not the whole sequence. As we are given the ending position of the number, we can calculate it's beginning position. For the operations,we can consider it in reverse order.

    Let's call the position of the query is now x,and consider the operation done before it become x.

    First. the operation reversed [l,r],then if the x is in [l,r] it should be l+r-x before this operation.

    Second. the operation shift [l,r] ,then if x is in [l,r] it should be x-1 before this operation. but if it's l exactly it should have been r.

    So you can solve the problem in O(nq).

    Sorry for my poor English, if it's still not clear, you can ask again.

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

      @pb0207, can you give me explanation sample test case for problem D?Problem statement aren't clear to me.Specially first operation isn't clear to me.

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

        The first operation is a cylic shift which is that all the numbers in the interval [l,r] goes right except the number on the position r which goes to l.

        That means for the array [1,3,2,4,5,6,7,9,8] if we do the first operation to the interval [2,5] , it would be [1,5,3,2,4,6,7,9,8]

        The second operation means to reverse the interval.Which means if you do this operation to the interval,then you can find the previous interval by reading from right to left. And for more formal explanation the number on position l would be equal to number on r,and l+1 equal to r-1 ,etc.

        And for the array [1,3,2,4,5,6,7,9,8],if we do the second operation to the interval [3,7] , it would be [1,3,9,7,6,5,4,2,8]

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

          pb0207 Thanks for your time ,consideration and forthcoming response. Sample testcase; - 6 3 5 - 1 2 3 4 5 6 - 2 1 3 - 2 3 6 - 1 1 6 - 2 2 1 5 3

          • for 2 1 3 array would be 3 2 1 4 5 6
          • for 2 3 6 array would be 3 2 6 5 4 1
          • for 1 1 6 array would be 1 3 2 6 5 4
          • for 2 2 1 5 3 answer would be 3 3 1 5 2 Isn't it?

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

      This helps a lot thanks!

      I was confused with this problem but now i get it! :')

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

    As for data structure, you can learn Treap or Splay which can reverse the array.And you can calcultate the final array in O(logn) for each operation.

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

      Hi pb0207 Do you know a good reference about treap and its reverse operation?? I've read a couple of pages about treap but they don't mention that!

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

        As I mentioned here, you can use lazy propagation to flip a segment of a treap. See my submission for its implementation.

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

For problem B, can any body explain why this approach is wrong:

iterate over all pair and find the pair with minimal absolute difference between weights, then delete them and repeat the process.

This gives a WA, any proof why it's wrong.

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

    I also don't understand how to prove these approaches wrong.I know this is an old post but maybe anyone can help as I usually get stuck on these types of wrong approaches.

»
7 years ago, # |
  Vote: I like it +14 Vote: I do not like it

When will be editorial published?

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

For problem E,why segment tree is not able to solve this problem?(I have change the array a for discretization) but I got WA on test 14.

The main idea I do is to add 1 in segment[l,r] and query the minimum value in this segment after all the add operations are done.Then if there is a segment whose minimum value can be greater or equal to 2 ,then this TV set is not needed.

It's that my fault in writing segment tree?But I'm so sure I could at least write a segment tree correctly...This is code...Please tell me what's wrong or just point out the solution itself is not correct...Thanks in advance...

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

    i too taught segment tree. but seeing values of array, i solved it in another way. i used binary search. 30619432

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

      Thank you for reply...But is there any monotonicity for binary search in this problem?I just think it's asking about whether there has a segment which have been covered by other segments completely...

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

        Yes and you can search that segment using Binary search by doing some preoprocessing. let me explain it.

        example:

        3

        1 2

        2 3

        3 4

        lets sort this segments by l and if same then by r.

        array = (1, 2) (2, 3), (3, 4)

        now we will create new vector where we will store working time of tv's based on previous tv.

        for example : (1, 3) (2, 5) as you can see the second segment (l2) is lying inside 1st segment. so we can write this as (1, 3), (4, 5). so here we converted the 2nd segment l to new time which is equal to r1 + 1.

        if r1 + 1 > r2, this means that second tv is totally not needed so we can output this as answer. for example: (1, 3) (2, 3).

        after building this new vector for out previous example it will look like this:

        array = (1, 2) (2, 3) (3, 4)

        newtime = (1, 2) (3, 3) (4, 4)

        now for each segments in newtime find how many segments are there in array. if there are more than one then this segment is not needed. for this use binary search, find the leftmost segment and then find the rightmost segment. count = (rgt — lft) + 1.

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

can anyone please tell me how to approach the problem B i tried all possible solutions from my side

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

When will the editorial be posted? Hacking phase is over already.

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

I need editorial of problem F.Can anyone please explain how to model flow network for this problem.

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

How to solve G?

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

Sorry for the late editorial, it is published now.

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

anyone can help check whats wrong with my solution for problem E, got RTE for 16th test case. http://mirror.codeforces.com/contest/863/submission/30694287

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

    The problem is in cmp function. Your comparator must always be like: if cmp(a, b) then !cmp(b, a).

    UPD: And one more mistake is in if-statement in main function.

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

is there answer?