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

Привет, Codeforces!

24 августа, в среду, в 19:35 MSK состоится AIM Tech Codeforces Round 3.

Раунд подготовили сотрудники компании AIM Tech: Kostroma, riadwaw, yarrr, ValenKof, Edvard, bobrdobr, malcolm, NVAL, nmakeenkov, agul, Extr и zeliboba. Раунд пройдет во время Петрозаводских сборов, спонсором которых является наша компания.

В каждом из дивизионов участникам будет предложено пять задач и два часа на их решение. Разбалловка будет статическая.

Как обычно, мы постарались сделать задачи проще, чем в прошлые раунды AIM Tech Round 1, AIM Tech Round 2, но не менее интересными.

Благодарим Михаила Мирзаянова (MikeMirzayanov) за замечательные платформы Polygon и Codeforces, и координатора задач Codeforces Глеба Евстропова (GlebsHP) за помощь в подготовке раунда. Огромное спасибо AlexFetisov и winger за прорешивание раунда!

Наша компания занимается проп-трейдингом, ключевыми понятиями в нашей работе являются big data, low latency и high frequency. В нашей работе важно алгоритмическое мышление и умение писать эффективный C++ код, поэтому у нас работает много спортивных программистов. Чтобы придумывать hft-стратегии нужно обладать хорошей математической интуицией и умением подходить к задаче с разных сторон, поэтому их созданием в нашей компании занимаются в основном олимпиадники-математики. В свободное от работы время мы участвуем в разных соревнованиях по программированию и не только, испытываем себя на прочность в походах и путешествуем.

Узнать больше о нас и наших вакансиях можно на сайте aimtech.com. Можно отправить нам резюме через эту форму, даже если вы не участвуете в раунде.

Всем удачи и высокого рейтинга!

Разбалловка в обоих дивизионах 500-1000-1500-2000-2500

Разбор

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

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

Now we know what is Edvard new job :)

It would be nice to make combinative d1/d2 round.

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

    I guess one can actually prepare the same problems for both divisions, just with different variable/time/memory constraints for Div1 and Div2 participants. But this sounds more woe than fun :)

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

Will there be T-Shirts as stated here? http://codeforces.me/blog/entry/23240?#comment-276543 :D

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

these aimtech guys really do have a very interesting field of working, artificial intelligence management, i never heard of it before.

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

Standard duration (2 hours)?

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

AIM Tech Round 1: -40, AIM Tech Round 2: -43. I hope my rating change will be positive this time :"D

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

Рейтинговое соревнование?

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

We made our problems a little easier

You said that last time, too — and it turned out to be just from "3rd place = 3 problems solved" to "6th place = 3 problems solved" :D

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

I know the AIM Tech Round is harder than the ordinary div2,but I will try my best to solve the first problem or the second problem.

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

Hope another exciting contest, interesting problem set :)

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

what does frequency mean?

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

i wish high rating for all :D

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

Thanks for codeforces to provide the chance for me to practice with you that from all over the world whitout money,thank you very much, i mean it :)

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

I hope that I will get a lot of points!

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

The comment is hidden because of too negative feedback, don't click here to view it

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

maybe it is new start.

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

ВСЕМ ЛАЙК ПОСТАВИЛ!

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

Wish that everyone can get a satisfactory rating.

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

Good luck boys !

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

What does "Scoring system will be static." mean? Usually it is dynamic if I'm correct.

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

    That means basic score for each problem is fixed before the contest (and it decreases during the contest linearly). Dynamic scoring means that basic score for each problem depends on number of accepted solutions.

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

    Actually, I think static scoring simply means that it is not 'dynamic scoring' which is detailed in,

    http://codeforces.me/blog/entry/4172

    Basically, instead of scores decreasing from a fixed amount, the 'initial scores' themselves would depend on the number of contestants who have managed to solve the problem.

    We don't see a lot of dynamic scoring competitions these days but they used to be relatively common about two years ago.

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

So fast Scoring System Update . #GLHF

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

I am a newbie since last febrauary. I hope to be a pupil in this round. I hate my gray color xD

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

I study in the Faculty of Mechanics, perhaps my study will help me solve one of the problems today :P

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

I will be back

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

.

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

tourist is registered!

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

9 legendary grandmasters participating :O

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

Div1B was super evil..

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

Good problems, but... After that contest, I hate the number 7 :(

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

0 0 0 0 for Div2 D/Div1 B :(

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

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

Made B 5 sec. after end of round

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

div2C — string of all a :D

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

Since "Round will take place during Petrozavodsk Summer Camp", I guess system test will start late?

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

what was the hack test for div2C

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

I wish aaa was not a pretest in Div 1A.

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

The difficulty was perfect and problems were interesting. A very nice round (I didn't read div1-d though). I hope there will be AIM Tech Round 4, one day.

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

I think that the description of Div2A was a bit misleading. "... When it happens Kolya empties the waste section (even if there are no more oranges) and continues to squeeze the juice"

To me that implies that Kolya stops squeezing the current orange, empties the waste section and continues to squeeze the same orange until there's no more juice. But magically, Kolya actually squeezes the entire orange and then cleans everything, resetting the waste bucket.

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

Very slow codeforces, but tasks were pretty interesting :)

I suppose it will be a lot of fail submissions after end of testing.

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

statement A was terrible :( so bad

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

Div 2 C was easier than Div2 B.

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

I submit 2 codes for problem A,my both code is accepted but on rank list time of second code is considered and also 40 points of penalty is also deducted .why it is so?

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

When will the system test start please? So I can decide whether i will sleep before school tomorrow Xp(only 3 hours before I must wake up again) Haha

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

Can someone give me a hit for Div 2.D??

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

    div2d had so many edge cases... The main can be solved purely using math. As for edge cases, there are (0,0,0,0) (0,1,0,0) (0,0,1,0) (X,0,0,0) (0,0,0,X) where X is a triangular number. You can deduce number of 0's and 1's in since a and d must be triangular, and a+b+c+d must be (n0+n1) choose 2, otherwise "Impossible". The last edge case is when a=0 or d=0, since there can be 1 or 0 of them. But if theres 0 then it reduce to X 0 0 0 and 0 0 0 X case Now you can say that when a=0 then n0=1 and d=0 means n1=1. Now prove that anything else left is always possible to build. :)

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

    although I have stuck with the 3rd case, I can say my idea.

    first, you can get number of ones and number of zeros in the string.

    where:

    1) No. of zeros * (No. of zeros — 1) / 2 = a00

    2) No. of ones * (No. of ones — 1) / 2 = a11

    You can check some validations using these numbers, a01 ans a11.

    No to build your string.

    ans = ""
    cnt = 0 // number of "01"s 
    while(No. of zeros and No. of ones) do 
      if(No. of zeros + cnt <= a01) 
        ans += "0",  cnt += No. of ones, No. of zeros -= 1;
      else ans  += "1", No. of ones -= 1;
    end
    

    then you should validate your string and you can do this in O(Length of strnig) by counting how many "01" and "10" subsequences and then check them with a01 and a10.

    I implemented this idea but I couldn't to figure this tricky case "0 0 0 0"

    sorry for bad English. :)

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

    Let the number of 1's in the string be X.
    Let the number of 0's in the string be Y.
    Then,
    1. the number of 11 subsequences = X choose 2
    2. the number of 00 subsequences = Y choose 2
    3. the number of 10 subsequences + 01 subsequences = X * Y (one of them is from 1's set other from 0's set)

    Assert the above conditions for solution to exist.
    Now let the requuired string be B, and let us start from a string A and try to construct B from it, where A =
    "11111.. (X times) 0000 (Y times) " — i.e., all 1's followed by 0's.
    A has X * Y number of '10' subsequence and 0 number of '01' subsequences. Now, notice if we shift the last 1 (the Xth 1) one position right swapping it with the first 0
    => 1111..( X-1 times ) 01000.. (Y-1 times)
    Now, A has X * Y — 1 number of '10' subsequences and 1 number of '01' subsequences.
    Keep doing this sort of shifting, you'll eventually be able to arrive at a01 number of subsequences and a10 iff (a01 + a10 == X * Y).

    Beware of corner cases like: "0 0 0 0"
    "K 0 0 0"
    "0 0 0 K" ...

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

Will there be anti-quick sort case on Div2-B for Java solutions?

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

Interesting systemtest. Waiting half an hour, then almost instantly 58%, then it stops again :D

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

Div 1 B is all red...

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

My solution got TLE on problem C. Are you serious???

Edit: Sorry, maybe I need to sleep more. >_<

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

Could've been a great contest for me, but no..........

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

One of the most interesting, well developed CF round ever. Thank you so much! :)

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

I can't believe I got WA on test 163 out of 164. -.-

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

...

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

How to solve div1-B?

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

    First, you should notice that a00 and a11 are triangular numbers(and it will give you the values of the number of 0's ans 1's, here you should be careful with a00 = 0, because there could be 0 or 1 zeros, the same for a11). Second, a10 + a01 must be equal to xy, and in fact (you can prove by induction on (x + y) that it's everything you need to construct an string with the conditions you want).

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

    So first of all you have to find how many zeros and ones there will be in total. in order to do that you look at the number of 00 and 11. Say number of 00 is 3 that means that we have 3 zeros in our string because you can choose 3 combinations of size 2 from 3 zeros. So basically if you have n zeros in your string the number of 00 will be n*(n-1)/2 and the same goes with 1's. Though there is something we have to look at, which is when you have 0 of 00's. then maybe there is 1 0 but definitely not 2 because if it was to number of 00 would be 1. So it will be 1 if number of 01 or 10 is more than 0. and same goes for 11's. after you determine the number of 0's and 1's you do the following: you start putting 0's and 1's. if you put a 0 you decrease total 0's. if you put a 1 you decrease total 1's. and if you put a 0 that means you increased number of 01 by the amount of remaining 1's because you will place remaining 1's after that 0 and it will be number of reamining 1's times so same goes for 1's . an algorithm would look like this for that :

    	while(zeros >0 || ones >0){
    		if(b>=ones){
    			printf("0");
    			b-=ones;
    			zeros--;
    		}else if(c>=zeros){
    			printf("1");
    			c-=zeros;
    			ones--;
    		}
    	}
    

    and there are still some cases. if a,b,c,d=0 then you print 0 or 1. if a b c= 0 but d is not you print only 1's. and vise versa. and if a or d is not in the form of n*(n-1)/2 it is impossible as well.

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

      How did you figure out that the approach of just writing out 0s and 1s greedily "while the current string doesn't violate the rule" would work? My first reaction was that I had to consider many different combinations, and, frankly, I still don't quite understand why this works.

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

        well it is not that hard to figure it out. lets say we have 5 0's and 5 1's. if you put 0 at the beginning how many 01's are you adding for that 0 ? 5 times right ? because it would look like this: 0xxxxxxxxx where x is 1 or 0 but in total there will be 5 1's in x's so for that 0 they will make 5 01's. and now you have 4 0's. lets say you will put 1 now. 01xxxxxxxx . and now we have 4 o's left. how many 10's can you make with that 1 ? 4 times right ? because you cant use the 0 at the beginning to make 10. and it goes like this, think simple dont make it complicated :)

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

I'm proud that I wrote the slowest solution on C :')))

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

Why can't I see test cases in practice mode? I want to know where my solutions fail.

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

Was stuck on problem B with test case n = 1 till the final 1 minute...lucky to discover that before end.

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

Hard time today lol!!!

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

the statement of problem A was terrible :( so bad

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

Can you please tell me why I got TLE in problem C !! that's so weird!! 20125382

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

How to solve Div2B ?

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

    just sort the data....now you need to visit n-1 points. So you have to check for 2 choices — either leave first point or the last point(in the sorted data set) which has 4 ways of doing so. Check my code — 20124041

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

      Can you elaborate more please ? I am not that good programmer you can see :(

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

        Sort the Points. Assume D as the given Point where you are standing presently ...Now,

        • calculate the distance between D -> Arr[1] -> Arr[N-1] ( Indexed by 1 )
        • calculate the distance between D -> Arr[N-1] -> Arr[1] ( Indexed by 1 )
        • calculate the distance between D -> Arr[2] -> Arr[N] ( Indexed by 1 )
        • calculate the distance between D -> Arr[N] -> Arr[2] ( Indexed by 1 )

        Now calculate the minimum of those result .

        Make sure you are checking all other Corner Cases like ... if the point D is in between Arr[N-1] & Arr[N] . ( there are 3 more Corner case according to my approach . I am sure your are smart enough to find those out )

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

        We have a position x. and an array a. sort array.

        the first case x <= A [0] then the answer (a[n-2] — x)

        second case x> = A [n-1] if the answer (x — a[1])

        in other cases the answer: a minimum of

        ( (2*(x-a[0]) + (a[n-2]-x)),

        (2*(x-a[1]) + (a[n-1]-x)),

        ((x-a[0]) + 2*(a[n-1]-x)),

        ((x-a[0]) + 2*(a[n-1]-x)).

        Multiply by 2 because they have to pass through this segment 2x. early in one direction and then in another. Choose from 4 variants the most profitable

        We do not forget about the option when n = 1; the answer is 0

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

Div. 2 Problem C has a complexity of O(n) but still I am getting Time Limit Exceed on test 27. My solution link is : http://codeforces.me/contest/709/submission/20121635

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

waiting for rating change

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

"Ratings will be updated shortly but they could be adjusted a little after cheaters punishment"

can anyone explain please? :(

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

Wish I can turn blue now! Waiting for editorial and how to solve DIV 2D?

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

What is this about cheaters?

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

Guys thank you so much for such an awesome contest, really enjoyed it, can't wait for more AIM Tech rounds

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

only Div1 Rating changes have been updated , why Div2 haven't been updated until now ?

UPD : it's now updated

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

а когда будет разбор?

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

This is the first time I solved problem D in a contest.....I was having some bad previous contests..I can expect a good rating change now :)

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

after all ... contest was easier than previous ones ...

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

what was the hack of problem c div2

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

can someone explain why aaaz is lexicographically < aaa ?

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

How to solve div2E ?

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

Как по мне, не стоило включать в претесты частные случаи: a для задачи С, 0 0 0 0 для задачи Д.

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

Как раз в этом раунде была бы уместна динамическая разбалловка, по крайней мере во втором дивизионе, раз уж B порешали хуже C.

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

    Не динамическая разбаловка, а просто задачи местами поменять стоило. Я, после решения Б, прочитав С, очень удивился и давай думать где тут подвох. Не придумал — и заслал после Б менее, чем через 5 минут. В то время как по Б я чуть неправильное решение не написал.

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

For Problem C i have coded a solution of Time Complexity O(n) but still i'm getting a TLE .

Can someone point out why this is happening?

https://ideone.com/oPOD8j

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

How to solve div2e?

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

    Remove largest tree from eccentric child if the tree is rooted at i. The largest tree's size should be of course <= N/2 as we will attach this tree directly to i. I used timestamping and some arrays to find the largest tree. You can refer to my last AC code.

    It was very hard to debug it during the contest sadly :( .

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

Чет очередь :/

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

Anyone Pls tell me how to solve the problem B in Div 2 ?

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

What happened to the rating changes? Are cheaters being dealt with right now?

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

so...... what happened to rating ?

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

I solved Problem B after reading through comment section and after numerous WA's and edge cases. I want to know how did people think about the strategy to solve it ? I was able to solve A and C quickly but could not even figure out how to do B during the contest. Can someone give me some pointers ???

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

    I struggled with it as well, but I can give you some tips.

    Sorting the points is never wrong in a task like this.

    Also, you'll always either choose not to visit the leftmost point or the rightmost point. For each of these, you'll either go like start -> left -> start -> right or start -> right -> start -> left, you take the min out of those 2 posibilities for not taking pos[0] or pos[n — 1].

    The edge cases are n = 1, n = 2 and if you're between pos[0] and pos[1] or between pos[n — 2] and pos[n — 1].

    I agree that the task is really ugly, but taking it step by step it's solvable.

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

    I'm a little late but maybe my answer will be relevant because it's fast to write and doesn't deal with many edge cases. It's a little overkill though.

    It was basically, store all elements and the initial position and sort them all. Then find where the initial position is in the sorted array, if there is a repetition take the smaller position.

    Now just think that you must visit i positions on left of initial position, 0 <= i <= n-1, and n-1-i positions on the right of the initial position. Then you just need to iterator on i and check if these left and right positions are inside the array.

    Take care that if you visit left first the result may be different of visiting right first so you need to consider both.

    That's my submission: 20114511. I found this way very fast to write and easy to cover all edge cases, took me 13 minutes and 0 WAs.

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

when i will get editorial of this round ?? :)

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

Thanks for editoral.

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

Can anyone please help me with the logic of div 2 E-Centroids?

After finding centroid, I find lca of all nodes. Then, I find the node v from each node u such that

n-subtree[v]<=n/2.

Then, I can make parent of v a child of u.

Before finding v, I make sure that none of the children of the root(centroid found initially) have a subtree such that it can be directly attached to u

//code removed

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

    hi, the link you provided does not show anything. make sure you make it public. i checked your last submission it doesn't seem to use lca in the solution.

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

      I'm sorry! last submission

      I realized that LCA is not needed(to my understanding). From the output it seems that I'm printing 1's instead of 0's for many nodes. A possible reason can be that my C itself is incorrect.

      1. Root the tree at a centroid C.
      2. Find subtree sizes. In array ma[], I store the index of two vertices, which are children of C, which have the maximum subtree sizes. This is so that when I am traversing inside the subtree with the maximum size, I can cut the other subtree, as stored in ma.
      3. If cutting one or the other subtree we have in ma[] doesn't help, meaning that

      n - subtree[ma[0 or 1]] - subtree[current node under consideration] > n/2

      then I cut the edge joining C with the subtree that I'm currently traversing. Clearly, such an operation only needs to check the subgraph containing C because the other subgraphs will definitely have size<=n/2.

      But I think I'm missing some test cases. Do you know which cases?