Автор awoo, история, 5 лет назад, По-русски

Привет, Codeforces!

В Nov/30/2020 17:35 (Moscow time) состоится Educational Codeforces Round 99 (Rated for Div. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

Поздравляем победителей:

Место Участник Задач решено Штраф
1 neal 7 223
2 jiangly 7 224
3 tute7627 6 190
4 nocriz 6 195
5 noimi 6 213

Поздравляем лучших взломщиков:

Место Участник Число взломов
1 MarcosK 41:-6
2 dapingguo8 34:-2
3 jerdno 12:-4
4 ARTpositive 10:-1
5 halyavin 9:-1
Было сделано 357 успешных и 769 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A edickLPM 0:00
B SSRS_ 0:03
C corol 0:03
D pajenegod 0:08
E neal 0:29
F jiangly 0:55
G jiangly 1:17

UPD: Разбор опубликован

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

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

Hope this round will be good

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

Another Educational Round! hopefully I will do better like previous Educational round. Hopefully the problem will be more interesting.

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

Another Educational Round. Hopefully I will do better like previous Educational Round. I think, The problem will be more interesting. Ops! I'm waiting for that.):

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

Notice the usual start time

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

Super Excited !!

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

This is my chance to go up to master!!!

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

People reading this comment, hope you have a good contest. All the best!!

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

May i become specialist this time !!

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

This may be my last contest before my college final exam. After that I will open my brand new advanced mathematics book and my linear algebra book. Oh my god, brand new(╥﹏╥). I hope i can get good results all of them.

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

Maybe the last round before senior high school...
It's time to say goodbye to you now guys. Hope we'll all do our best in this round. :)

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

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

the comment section is shit

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

Score distribution awoo ?

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

In the hope that I don't mess this round by silly and not required lengthy implementations.

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

I have end semester exam tomorrow. Should I compete this round?

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

I just pray and hope that it wouldn't be another Mathforces round.

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

aaja mahi aaja mahi aa soniya aa ve aake aaj mere gale lag jaaa tu hoye....

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

When will be shown the difficulties of tasks from Codeforces Round #685 ? It's been more than a week ago!

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

7 min left be ready i hope u solve many problems good luck :D

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

My opportunity for Expert

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

I'm gonna participate so more chance to gain lost rating on sunday

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

Congratulations to the 100000000th submission!

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

Most uninteresting problem set ever

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

Congratulations to ub33 for the 1e8-th submission!

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

Is C's statement an english test? I can't understand it.

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

Either I will live or geometry in this world !!

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

How to solve E?

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

How to solve E??

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

How to solve E ???

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

ez game pls dont hack me pitch

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

Use me as dislike button if you also didn't like this contest.

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

Solved C in 1 minute after the announcement ;)

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

It's the second time in a row that in a Educational Round problem C is easier than problem B, what is this :(.

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

How to solve E?!

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

Sounds stupid.. But someone help me with B

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

    After you draw the steps (don't come back initially) you will realize that you can come back by not making some pth move in front, but by just making it backwards. suppose you are at point y such that y>x, you need to check if there exists some p, such that (p+1) = (y-x). this accounts for not making the pth move in front, i dont have proof, but since p can take all natural numbers, it's always possible.
    and yeas if(y-x)=1 then add one.

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

Solved Div.2 D for the first time.

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

How to solve c (please tell along with proof) ?

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

wasted 35 min on b then did c in 1 min then went to b for another 35 min to actually solve it. C must have been in place of A. C<=A<B<D

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

I miss those times when Educational used to be great!

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

Thank you for the new mathforces round !

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

Is it just me or the game thoery problems are a bit tough to understand?

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

Strong dislike for C, it is completly based on observation and hence has no educational worth at all. That might be a nice problem, but simply misplaced in educational contest.

It is basically no programming problem.

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

The best boring ping pong in C.

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

I don't like this round. Learned nothing from ABC.

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

How to solve B ?

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

I might get a lot of downvotes here, but I felt that $$$C$$$ was a pathetic problem, with no learning at all.

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

What was the intended solution for problem D?? Was it DP or greedy??

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

    greedy

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

    I used a greedy approach: First check whether the original array is already sorted or not. If it is sorted, print 0. Otherwise traverse the original array. Swap the value at current index with 'x' if it's greater than x and increment your answer by 1. At every step of the traversal check whether the Array has become sorted or not. The low constraints allows this. If it has become sorted print your answer. At the end of the traversal if the array is not sorted print -1.

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

    It was a greedy solution. I solved it this way:

    • Notice that $$$x$$$ is monotonically strictly increasing.
    • If at any point, for any $$$i$$$ starting from $$$1$$$ to $$$n$$$, $$$a_{i \dots n}$$$ is sorted, break out.
    • If for any $$$i$$$, $$$a_i \gt x$$$, do the operation. As an operation can only lower down the value of an element, so it is optimal to lower down the values when possible starting from the left.
    • Finally, at the end check if $$$a$$$ is sorted, if it is, then print the moves you took, else print $$$-1$$$.

    Update: Cleaner and faster code.

    C++ Code: 100058194

    Time Complexity: $$$O(n)$$$
    Auxiliary Space: $$$O(1)$$$

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

Problem C was really ambiguous. Strongly dislike it.What was the point of it?

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

Maybe my complexity analysis was wrong. But I think I probably submitted an O(n^3) solution to the problem D where the sum of n over all test cases was <=500. Am I missing something in my complexity analysis? I would be glad if someone helped out.

My submission: 100048016

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

Got VERY stuck on B ;(.

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

Interesting problem С, liked it. But, in my opinion, problem B is more difficult than problem C :(

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

neal's stream is running now, feel free to join :)

https://mirror.codeforces.com/stream/71

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

I can't believe D is just mostly implementing what they given, I overthought that so hard D:

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

Someone, please help me with the logic of problem D. Thank You in advance!!

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

how to solve b

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

    Find the cnt where cnt*(cnt+1)/2 is just greater than x Then find by how much it is greater than x,let it be y=(cnt*(cnt+1)/2)-x; Now just we have to remove the step y which can be done without any extra step. if y>1 so ans = cnt and if y==1 ans=cnt+1

    Let's say x=7.So cnt=4; And the guy moved 1+2+3+4 steps. Then his final position is at step 10; y=(1+2+3+4)-7=3 Only if he could move 3 steps behind then the problem will be sorted. So we just need to remove the step size 3. So lets do Step 1: +1 position =1 Step 2: -1 position =0 Step 3: +3 position =3 step 4: +4 position =7

    So we get the minimum number of steps as cnt=4

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

    For B, let's use only +i as long as sum < X.

    +1  +2  +3  +4  ...  + K  =  S  (>=X)
    
    If we switch a "+i" to "-1", then S updates to S-i-1
    That is great, because for i = 1, 2, 3.. it is -2, -3, -4 ... -K on S with no more jumps (result = K), and we could reach any S, S-2, S-3, ... except S-1, in which case we need an additional "-1" jump (result = K + 1).
    
»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How the answer of B for n=12 is 5 ?

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

How to solve B?It took me an hour and a half to solve problem B,but I did not succeed in solving。

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

    Find the cnt where cnt*(cnt+1)/2 is just greater than x Then find by how much it is greater than x,let it be y=(cnt*(cnt+1)/2)-x; Now just we have to remove the step y which can be done without any extra step. if y>1 so ans = cnt and if y==1 ans=cnt+1

    Let's say x=7.So cnt=4; And the guy moved 1+2+3+4 steps. Then his final position is at step 10; y=(1+2+3+4)-7=3 Only if he could move 3 steps behind then the problem will be sorted. So we just need to remove the step size 3. So lets do Step 1: +1 position =1 Step 2: -1 position =0 Step 3: +3 position =3 step 4: +4 position =7

    So we get the minimum number of steps as cnt=4

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

MarcosK Make a nice hacks for E

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

This was my first contest ....can someone please send me solution for strange functions A question ? Pls it will be of great help ...thanks

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

The constraint of $$$E$$$ is $$$1\le t \le 10^4$$$,but the maximal $$$t$$$ for the tests are $$$1000$$$ only...

That's why there can be a lot of hacks in $$$E$$$...

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

Is it codeforces or ObservationForces?

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

This was a really nice round, but I have to complain about problem E. I hacked more than 40 submissions (including mine), just because the complexity is $$$O(log(10^9) * 4!)$$$, and all of them exceeded time limit because of having 10^4 subtests. I don't get the decision of the setter about it.

Besides that, thank you for the round, i loved the problems!

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

problem C was much much easier than b.

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

any tutorial for b please

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

A~D: No programming, just observation and math...

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

No offense to the writers but I don't really think this contest is educational.

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

Adhoc-Forces crossed 100 million+ submissions. wow!

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

How to solve Problem E?

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

    Essentially you are compressing the x and y co-ordinates each to two distinct values, and the problem has many similarities to making all elements of an array equal. In the array problem, you compress all elements to be equal to the middle value, or in the case of an even-length array, one of the middle values.

    In this problem, we want to compress the co-ordinates such that x and y deltas are minimal. If we sort our starting X co-ordinates (X1,X2,X3,X4) and starting Y co-ordinates (Y1,Y2,Y3,Y4), ideally we will compress them such that all x co-ordinates are between X2 and X3 inclusive, and all Y co-ordinates will be between Y2 and Y3 inclusive. The optimal length of the square, L, will be the max(Y3-Y2,X3-X2), since we don't want to compress the square more than necessary.

    Suppose we cannot fit the whole square inside the bounding box X2 to X3 and Y2 to Y3. Then we want as much of the square as possible to be inside that bounding box, and as much of the rest of the square to be inside the bigger bounding box X1 to X4, Y1 to Y4. It can be seen quite easily by drawing an example that any shift outside of these bounding boxes is sub-optimal.

    So we can say the bottom left corner of our square is at (min(X2,X4-L),min(Y2,Y4-L)). [Note the we equivalently could have positioned the top right corner at (max(X3,X1+L),max(Y3,Y1+L))].

    Therefore we have the four co-ordinates of the optimal square. From there we can try all 24 permutations of starting points to corners, and find the optimal one. There may be a neater way to do this final step, but I brute forced it as 24 is not many.

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

      I dont get it how here the connection between x and y is done. Since it is a square x and y size of resulting rect must be same. But the logic separates the x from the y coordinates :/

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

        The logic combines the x and y results, though.

        • Length (both horizontally and vertically) = max(Y3-Y2,X3-X2), so the length is determined by the x and y co-ordinates

        • Bottom left corner of square is at (min(X2,X4-L),min(Y2,Y4-L)), so the position of the square is also determined by the x and y co-ordinates

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

      This is my approach for E after taking some ideas from jimm89 :

      int x[4], y[4], old_x[4], old_y[4];
          for(int i = 0; i<4; i++){
              cin>>x[i]>>y[i];
              old_x[i] = x[i];
              old_y[i] = y[i];
          }
          sort(x, x + 4);
          sort(y, y + 4);
          int b_a_u = x[3] - x[0]; // The upper limit for difference of x2 and x1 where x1 and x2 are defined below
          int b_a_l = x[2] - x[1];
          int d_c_u = y[3] - y[0];
          int d_c_l = y[2] - y[1];
          int side = min(b_a_u, d_c_u); 
          int x1 = max(x[0], x[2] - side);
          int x2 = x1 + side;
          int y1 = max(y[0], y[2] - side);
          int y2 = y1 + side;
          cout<<findmin(old_x, old_y, x1, x2, y1, y2)<<"\n";

      Here, x1, x2, y1, y2 are choices for the lines that define the square (4 lines x = x1, x= x2, y = y1, y = y2) and findmin() checks the minimal distance to corners in all permutations. https://mirror.codeforces.com/contest/1455/submission/100091962

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

    Here is a case-work based solution (no binary search) to problem E: https://mirror.codeforces.com/contest/1455/submission/100073456.

    Edit: I'm not sure if this solution is always correct.

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

Guys look at this Topic(Contest) rating, going to 0 XD

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

Guys look at the topic(contest) rating, going to zero XD

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

How to solve E?

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

Me after reading the solution of problem C

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

Coded an n^3 solution for D using DP, is it hackable? 100060462

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

Is the round difficulty below average ?

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

G was nice, thanks authors! Sadly, I needed 20 more minutes to solve it :)

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

Solving A-D feels like guess some conclusion and just try it...Even don't need to think seriously. Am I too impulsive?

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

    I own none of these problems' ideas but I personally find the observation problems the hardest of them all. They tend to make me think a lot more than the standard-ish ones and usually way more than it takes people of my rating :( The fact that you don't need to think seriously just shows that you have better intuition I guess. So you can enjoy your "free" rating and the guys like me can enjoy practicing more in this kind of problems :P

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

I can't understand why so many people downvote a contest. Just for the problems? ok but also the writers and the testers make some effort to gives us these contests. And about the problem : Easy A like always , a easy math problem for B , C an observation one and D greedy (I Didn't understand that N <= 500 but that is not an issue). If A-D were easy why just 300 make at least 5 problems? You can say , was a huge gap between D and E and I agree , but that s not a reason to downvote a contest. I enjoy every contest (and I would like to see more DP and graph problems in div2 and Educational contests)

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

Problem E is not binary_search

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

Good contest. Finally I can be expert

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

hi all, in problem B,if we consider only the first operation jumping to y+k, then we can do the following jumps,

on 1st jump 0 to 1

on 2nd jump 1 to 3

on 3rd jump 3 to 6

on 4th jump 6 to 10

so we get the following series of 1 3 6 10 15....

now what i did is stored this series upto the given constraint of x which is 10^6 in a vector a. Then if x is just greater than or equal to any a[i] I calculate ans=i+1+a[i]-x where i+1 is the jumps to reach a[i] and a[i]-x is to move back to x by using the second operation y-1;

now after this I noticed this that for x=4 following is the optimal operation

1st jump 0 to -1

2nd jump -1 to 1

3rd jump 1 to 4

then i noticed if we do this kind of operation for any x(except 1 2 3) the total number of jumps will be x-1;

so at last i took min(ans,n-1).

is my approach wrong?pls help here is my code

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

    You seem to have made a few false assumptions, just trying to get your formula to match the example solution.

    The main problems are that the min with n - 1 doesn't really play a role for larger n, as the answer starts to increase much slower than $$$n$$$. The other one is that the answer will be the same for multiple consecutive $$$n$$$, where a[i] stays the same, but your formula does not account for that.

    Thus, as the second test shows, for example with input $$$7$$$, a[i] is $$$10$$$, i is $$$3$$$, and it is possible to reach $$$7$$$ with the sequence $$$0, 1, 0, 3, 7$$$ ($$$4$$$ jumps), but your formula gives $$$3 + 1 + 10 - 7 = 7$$$, and with the minimum $$$min(7 - 1, 7) = 6$$$.

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

Problem G is really nice.Thanks!

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

I can't understand why people are writing wrong code and then hacking theirselves like this guy — SabrCoder

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

I personally believe that if problem C was given as Problem A I would have come up with a solution much faster, I just thought since it was a C problem, it can't be so simple!

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

Can we apply BFS in B problem??

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

Solved D with DP and used only two states — [index][x]. I thought that x and prev are inter-related. I also tried [index][prev] but it was wrong. Is it wrong and just a coincidence with test cases? https://mirror.codeforces.com/contest/1455/submission/100080134

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

anything on when ratings will be displayed?

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

I'm curious why Educational Round doesn't system test instantly after finishing the hacking phase.

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

Next time add/change notes or info in the main problem page too. In problem C, changes didn't show up after refreshing the page.

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

where is the editorial?

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

Where are the tutorials?

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

Can we solve 2nd using dp?

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

Below average problem set.

Cf standard going downward day by day

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

when will the rating changes will be published ???

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

what about ratings update?! hacking phase is annoying.

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

It's annoying to check and find that the rating is not changed yet. update: Oh finally! the rating changed.

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

By when shall we expect ratings to change?(Don't know why I'm getting so excited for having a -30 :( )

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

Why the rating hasn't been updated yet?

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

Has it ever occurred that after a round has been conducted the ratings are not updated and as a result the whole round gets canceled? Just Curious.

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

I don't know why does it take so much time to give us the rates !

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

Why codeforces takes long time for the rating?what's going on.

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

Will the editorials be published for this contest?

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

bad luck :(

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

Ratings updated

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

After 6 months finally expert, excited

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

Have you noticed codeforces just crossed 100M submissions during this(Edu 99) contest?

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

Thanks for the contest for +191 and pupil :)

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

worst contest ever :/

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

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

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

Girl say:Can you open this jar for me? Boy say:Download Java