Блог пользователя vovuh

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

Внезапно, в этом раунде тоже будет 7 различных задач! :)

UPD2: В раунде будет 7 задач и одна из них будет содержать легкую и сложную версии!

<almost-copy-pasted-part>

Привет! В 26.04.2019 17:35 (Московское время) начнётся Codeforces Round 555 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Наверное, участникам из первого дивизиона они будут совсем не интересны, а для 1600-1899 покажутся простыми. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.

Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо моим очень хорошим друзьям Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.

Удачи!

Также хочу сказать, что участники, намеренно отправляющие неверные решения и взламывающие их после окончания соревнования (пример), не будут показаны в таблице лидеров по взломам.

</almost-copy-pasted-part>

UPD0: Я также хотел бы поблагодарить моего друга Адилбека adedalic Далабаева за помощь с пониманием сложности задач и другую помощь в подготовке раунда!

UPD1: Большое спасибо dreamoon_love_AA, Ashishgup, Jeel_Vaishnav и love.zy за тестирование раунда!

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

UPD4:

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

Место Участник Задач решено Штраф
1 dgkutd605 8 282
2 maguihong1238 7 347
3 dreagonm 7 373
4 DeathYmz 7 571
5 BaiBatyr 6 189

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

Место Участник Число взломов
1 achaitanya.sai 448:-33
2 Disappointment 127:-20
3 wzw19991105 39
4 ismagilov.code 50:-23
5 Kucha 20:-3
Было сделано 919 успешных и 365 неудачных взломов.

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

Задача Участник Штраф
A ImNotExpert 0:01
B BaiBatyr 0:06
C1 Darshit_99 0:10
C2 Injetzk 0:16
D iamnotacoder 0:21
E BaiBatyr 0:12
F Injetzk 0:29
G Injetzk 1:15

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

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

vovuh get ready to surpass Petr in the contribution table

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

Recovery Time of Rating. :)

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

Nice round ID! I love it :)

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

Suddenly, this round will consist of 7 different problems also!

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

Can explain how it is possible:

"I also would like to say that participants who will submit wrong solutions on purpose and hack them afterwards (example) will not be shown in the hacking leaders table."?

I hack myself? or i submit from other accaunt and hack this submission? in this case, how to identify this?

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

    Probably both. It is really easy to detect — cheaters will often have something like if(n==123445): print([obviously wrong number])

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

Only if this was my last div 3 :(

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

why does vovuh mostly sets problem for Div3 and Educational Rounds only ??? P.S: I like his problems ;)

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

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

When round start me "body oh my losing all my rating"

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

Что такое штраф 10 мин?

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

    На рейтинг в таблице влияет количество сданных задач и штраф. Штраф приплюсовывается только после того, как сдал задачу по формуле 10*(количество_попыток — 1) + количество_минут_от_начала

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

In reference to the UPD1, what does it mean to "test a round" ?

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

    that means the testers will solve the problems of the round, and give feedback to authors if they found a bug or statement is unclear or something

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

What does it mean that "the penalty for the wrong submission in this round [...] is 10 minutes"? Does this mean that if I submit a program that doesn't pass test #47 then I will only have 1h 50min for the whole competition?

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

Пишу на C#, не могу сдать задачу, получаю "Ошибка исполнения, код возврата 13131313"? Локально компилируется и с студии, и через csc.exe, всё работает. Код ошибки тоже странный какой-то. Весь код обёрнут в try-catch, так что вообще удивительно, что там какой-то runtime exception может быть. Кто-нибудь сталкивался? Подскажите?

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

    Что интересно — методом подбора нашёл причину.
    Причина — использование HashSet.
    Он, что, запрещён на контесте? о_О

    Разница между посылками только в одной строке: в одной используется HashSet, в другой List:
    53333897 — Runtime error 13131313
    53334189 — OK

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

      HashSet вряд-ли, но писать такие комментарии во время контеста — да.

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

        Извиняюсь, если что-то не так сделал. Я предполагал, что код посылок всё равно не доступен во время контеста, а информация о том, что для решения можно использовать HashSet — бесполезная, разве нет?

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

      HashSet от long не работает на этой версии Mono

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

      Странные вы, ребята. Зашли, накидали штук 15 минусов, но ни один человек не объяснил — за что. Код чужих посылок недоступен во время контеста (верно?), других деталей или кода в комментариях нет. В итоге я в минусах, но так и не понял что не так в моём оригинальном вопросе про ошибку 13131313.

      С точки зрения здравого смысла, одного комментария "пожалуйста, не надо (что делать) во время контеста, потому что (причина)" было бы намного эффективнее, не находите?

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

        А где ошибка то? У обоих посылок Полное решение.

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

    HashSet разумеется никак не запрещен. Мое предположение — void'овый Main.
    Это частое требование, убеждаться что программа возвращает 0 в конце.

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

Блин Div 3 это очень круто но если Vovuh создаёт задачи будут сложнее чем Div 2

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

    А в чем интерес решать все время легкие задачи?

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

      Но это же див 3

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

        В нем были легкие задачи, то что раунд div3 не означает, что все задачи должны быть легкими

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

How to solve D ?

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

    Hint : With $$$x$$$ as your first number, you can construct array for all $$$n$$$ in range $$$(kx + k*(k - 1)/2, x(2^k - 1))$$$

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

      Can first number be any integer? I took it as 1 and thought I can solve the problem with range updates easily by tracking max value of every index and what to add to reach N, but failed at TC 5. For first sample it is going like: [1,2,3,4,5,6] -> [1,2,4,5,6,7] -> [1,2,4,5,6,8]. Edit: Just saw TC 5, we can use any number as first number :)

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

What is 5th test case of E !? Can't find any mistake in my solution >_>

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

    In your code :- " auto bs =pam.lower_bound(n-a[i]); " It may point to pam.end();

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

Very Very Very nice round! interesting problems!!!!!!!!!! easy to understand! hard to solve!( for me ..)

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

plz don't ask about the solution since the hack is still avaliable.

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

Can anyone please confirm if my following submission has a time complexity of O(n*n) or not for E? According to me , it does. Link. Moreover, I would appreciate if someone can hack it as I am not really aware of the working of the test generator to generate such tests. Thanks !!

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

    Yes, it is o(n*n).try a=200000*0 b=200000*199999 , will get a tle

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

      Hi. Thanks for replying. It got hacked but just to inform you, I think my solution will pass the test case provided by you as all the elements of input array a are same. So basically, it will only search once and in all the next iterations it'll just execute the O(1) operation. The test case over which it'll fail will be something of the type

      20000 0 1 2 3 4 ............ 19997 19998 19999 0 0 0 0 0 0 ..........0 0 0

      In this case, it will calculate the ideal mod for every entry in array a by going through every available value in b before choosing the optimal one.

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

Hey ! For problem C1 (https://codeforces.com/contest/1157/problem/C1) , I want to know what should be the output for these test case:

case 1 5 1 2 3 4 5

case 2 5 5 4 3 2 1

case 3 1 2

Thanks in advance

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

Any counter case where my solution fails for C2?
apparently codeforces is giving WA on TC 15, but string is of length>1000 so I can't dry run and see where it went wrong.
My submission

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

    input 5 5 6 7 6 6 causes infinite loop, you don't handle well situation when A[left] = A[right]

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

I want to know why my solution for C1 in java got TLE while the same solution in C++ got Accepted. Java version: 53356781 C++ version: 53359020

I'd also like to know why I got compile error when I used linked list of java to solve C1. It works fine on my computer. The version of my jdk is 1.8 by the way. 53350776

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

    Because in java String concatenation creates a new copy of the string so that the overall complexity is O(n^2). You should use StringBuffer and use append() method for the concatenation. It will work in O(K). K is the number of characters.

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

 Greedy Festival XD

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

is multiset erase() faster than vector erase() ? My solution got accepted when I used multiset instead of vector in problem E.

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

    yep, vector erase() in O(n) and multiset erase in O(logn)!

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

    erase in std::vector have the complexity linear to the size of the vector (it have to move the elements after the deleted element forward), while that in multiset is have the complexity log of the size of the vector.

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

    Yes, multiset is implemented as a self-balancing binary tree, for which deletion is O(log n).

    Vector deletion is O(n) in the worst case.

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

Can someone please help me figure out why my solution is giving TLE on test 16 although similar solutions have passed all tests.

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

Sorry, "Div3 round"… There won’t be a next time.

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

For Problem A I used a set to add values which are not present earlier . After generating next number if it is not in set add it until you find repeating number in set . Return set.size()

Is the approach decent ?Started using STL more often now a days .

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

I wrote 2SAT for G, but I got TLE. It works O(const * N^3). For my opinion it must pass in 2 seconds :/.

UPD. Number of edges are N^2, so that all program works O(N^4) :(

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

Need Help in Problem C1: why im gettting TLE in Testcase 10 whereas other similar soln's are working?? 53371370

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

Yet another interesting case of cheating by 4ul_sharma and utkarshv3 who are from the same institute: Check here. MikeMirzayanov and vovuh please look into it.

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

Problems in this round are interesting and pretty good, thanks to vovuh for setting these problems.

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

How to solve F?

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

    Take it for an example:

    7

    4 3 5 1 2 2 1

    Instead of putting people of different heights randomly with keeping the difference between two adjacent heights one (e.g. 2 1 1 2 3), you can try to find a maximum height and a minimum height and form a cycle with other heights in between them. To do it, you have to find the longest possible contiguous non-decreasing sequence of numbers with difference between adjacent numbers 0 or 1 in the sorted array of heights. Notice that we need at least 2 elements of same value except for the maxima and minima in our output sequence, else we cant form the desired cycle.

    For our example we go like this, if we take 1 as our minima and we can go upto 3 as our maxima. As we have only one 3 we can't accommodate 4 here. So we can form a sequence like this, 1 2 3 2 1. So we start from our minima, climb up to the maxima and again climb down to the minima. I hope you got the insight.

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

In Problem B , What's wrong in this ? https://codeforces.com/contest/1157/submission/53365568 Gives WA on TC 7

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

    Try this case:

    6

    234567

    1 1 4 4 6 7 8 1 1

    Your code stops at the 3rd element (4), while it is more optimal to continue.

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

Guys, given a multiset m; does someone know the explanation behind lower_bound(m.begin(), m.end(), x) timing out in E(>2000ms): here, whereas m.lower_bound(x) gives AC with 233ms: here. I feel so frustrated and confused right now.

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

I really like problem G. With 1 clever observation, you can solve the problem in $$$O(nm)$$$.

There is a solution to the problem if and only if there is a solution with first row all zeros or a solution with last row all ones.

Proof: $$$n = 1$$$ is trivial. For $$$n \geq 2$$$, for a valid solution, as the array is sorted, the 0-1 boundary must lie on one row, and all the other rows should either contains all zero (rows before boundary row) or all ones (rows after boundary row).

Therefore, we can try check only 2 column configurations (1. flip all ones in first row, 2. flip all zeros in last row) to find the answer. The row configuration can be found by checking whether the row have a mix of zero and ones after flipping the columns.

Thanks for the great round! :D

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

    Thanks for your great idea!:)

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

    Very nice! thank you

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

    I had a different idea resulting in $$$O(nm)$$$ time complexity. But mine was very laborous to code. Submission: 53355339

    Assume that the array is fixed. How do we check if it can be turned to only zeroes?

    1. Either toggle the first row or not
    2. Toggle every column with a one in the first row
    3. Toggle every row with a one in the first column

    Make an data structure that can maintain the state of this algorithm when we change bits in the original array, and make two instances of it, one with the first row flipped and one without. Then do the following:

    1. check if either datastructure can be made all zeroes
    2. If either could, output its current row- and column flips.
    3. Otherwise, toggle the last bit that is not yet toggled in both. This essentially changes the solution we want to produce from all zeroes to zeroes in all but some suffix.
    4. If there was no bit to toggle, output NO
    5. Otherwise, update the two structures, and go back to step 1.

    Why is this $$$O(nm)$$$?

    When you toggle a bit that is not on the first row or on the first column, the structures do not need to be updated, so the change can be done in $$$O(1)$$$. There are $$$(n-1)(m-1)$$$ such bits.

    When you toggle a bit that is on the first column but not on the first row, you have to toggle one row, which can be done in $$$O(m)$$$. There are $$$n$$$ such bits.

    When you toggle a bit that is on the first row but not on the first column, you have to toggle one column, which can be done in $$$O(n)$$$. There are $$$m$$$ such bits.

    When you toggle the bit both on the first row and column, you have to run the algorithm again in time $$$O(nm)$$$, but there is only one such bit.

    So in total, we do $$$O(1) \cdot (n-1)(m-1) + O(m) \cdot n + O(n) \cdot m + O(nm) \cdot 1 = O(nm)$$$ work.

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

How to solve D with binary search?

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

    I will try to explain the idea of how i did.

    Suppose an integer x can be used as a1.

    Let the restritions:

    1. sum of all ai for i from 1 to k should be n;
    2. the condition ai<ai+1≤2*ai should be satisfied for each i from 1 to k−1.

    The min possible sum of array a, respecting the restriction 02, is reached when we increase each element subsequent by one.

    The max possible sum of array a, respecting the restriction 02, is reached when we increase each element subsequent by multiplying by 2.

    Therefore, to respect the restriction 01, the inequality down needs to be true:

    $$$x+(x+1)+(x+2)+(x+3)+ ... +(x+k-1) ≤ n ≤ x+x*2+x*2^{2}+x*2^{3}+ ... +x*2^{k-1}$$$

    The left side is a sum of arithmetic progression and the right side is a sum of geometric progression, so:

    $$$\dfrac{(x+x+k-1)*k}{2} ≤ n ≤ x*(2^{k}-1)$$$

    Thus, we can binary search the x:

    • If $$$\dfrac{(x+x+k-1)*k}{2} ≤ n ≤ x*(2^{k}-1)$$$, this x can be used;
    • If $$$\dfrac{(x+x+k-1)*k}{2} > n $$$, we have to decrease x;
    • If $$$ x*(2^{k}-1) < n$$$, we have to increase x.

    After find a possible x to be a1, we can binary the others elements of array a at same way.

    Complexity: O(k*log(N))

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

      I did the same but for finding k, I applied the formula: x= (n-sum(1 to k))/k.

      This will give you x in O(1) time. So I don't think it necassary to apply binary search.

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

"And for 1600-1899 the problems will be too easy" Not quite sure about this statement :o

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

I overslept and finally I didn't participate this contest!Oh no.

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

what is trashforces without getting WA on at least one problem for making a stupid mistake that the shitty pretest couldn't alarm you about..............

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

If S is a multiset. And what is the difference between S.lower_bound() and lower_bound(S.begin(),S.end())?

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

    According to documentation: Complexity of std::multiset::lower_bound is: Logarithmic in the size of the container.
    Complexity of std::lower_bound is: The number of comparisons performed is logarithmic in the distance between first and last (At most log_2(last - first) + O(1) comparisons). However, for non-LegacyRandomAccessIterators, the number of iterator increments is linear.

    std::multiset::iterator is a bidirectorial iterator, but it isn't random access, thus std::multiset::lower_bound will work faster ($$$O(log(N))$$$ vs $$$O(N)$$$). In general, if you have to choose between container's method and an algorithm from std, the first option is more preferable. (There are some exceptional cases, but they are not related to competitie programming)

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

How to solve problem G? I tried couple things, but nothing worked.

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

Hi everyone

My submission 53393992 for problem E is failing on the first test case itself. But, when I run it on my terminal, it is giving the same output as the expected one. (same code on ideone.)

Can anyone tell me what's going on?

Thanks

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

Can someone tell me what's wrong with testcase 6 for my submission 53339053. The input is no correct.... The third line is mssing....

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

Can anyone tell me why my solution is giving wrong answer for Test case 10 on problem C1. Submission 53345673

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

Why it works? Solution of the problem F working with quadratic asymptotics O((N/2)^2). The same solution with promotion i, linear asymptotics O(N).

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

achaitanya.sai Hackcount 448 Wow! good job!

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

what should be the answer for this test case for problem C1 test case

5

4 2 3 1 5

according me it should be 3

2 3 1

am I right ??

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

    you misunderstood the problem. take leftmost or rightmost elements and make a strictly increasing sequence with those.
    5
    4 2 3 1 5
    the answer is 2
    LR
    take 4 (the leftmost elements) first and then 5 and make this sequence that is in increasing order{4,5}

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

WA 53. плиз, скажите в чем ошибка) https://codeforces.com/problemset/submission/1157/53613426