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

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

У меня середина сессии, но я все равно пытаюсь готовить Div.3 раунды.

<copy-pasted-part>

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

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

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

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

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

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

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

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

Удачи!

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

</copy-pasted-part>

UPD: Также спасибо Роману Roms Глазову, Farkhod Farhod Khakimiyon и Alex hohomu Poon за помощь в тестировании раунда!

UPD2:

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

Rank Competitor Problems Solved Penalty
1 Doma_Umaru 6 331
2 BigDelta 5 141
3 AbduM 5 262
4 PauloMiranda98 5 266
5 Fill_in 5 276

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

Rank Competitor Hack Count
1 MarcosK 84
2 hmducanh 67:-4
3 jsuyash1514 58
4 Warawreh 29
5 darkness_peach 25:-2

Всего было сделано 796 успешных взломов и 2063 неудачных взломов!

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

Problem Competitor Penalty
A lee_chaerin 0:01
B ajarindong 0:02
C BigDelta 0:15
D1 Sad_reacts_only 0:26
D2 bigbigbigcat111 0:40
E Patunia 0:24
F Patunia 0:12

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

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

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

anothert trashforces made by trash russians

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

    The legendary grandmaster Intellectual said! Oh wait...

    Jokes aside, it can be very usefull for those who are slightly weak at maths or have no experience of solving algorithmic problems but want to practice in coding. And imho even for some 1600+ last problems are not such a trash.

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

Last line increased my expectations for the round.

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

div1 + div2 = div3

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

Good luck in your exams! vovuh

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

Thanks Man! I just wanted another div3

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

it is raining contests

3 contests in 5 days

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

Good Luck!

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

And guys, that's how <copy-pasted-part> becomes a legend.

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

Cool! Long time no see the Div.3. I hope I will have fun in it.

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

I really like this Div.3 because I am a new hand absolutely! Thanks to the beloved author and say good luck to everyone who take part in this match!

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

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

What does trusted participant mean. Plus how to hack solutions of others once if we submit the solution

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

    you_paison, there's a link on "Remember that" in the piece of the text about trusted participants. There you can find the definition and the motivation of this term.

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

5+2 = 7 Seems a lucky round! #527
UPD: NO, it was'nt :(

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

hope that i can be blue :D

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

    C is a pretty weird problem for me :( i tried to solve it with two different algorithms but all failed even though i knew how to solve it

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

Probably, participants from the first division will not be at all interested by this problems

Probably they even can't solve them.

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

Даа, сложный контест получился. Разница между задачами С и B слишком большая, а между D и C все больше. Все равно спасибо Vovuh за хороший контест.

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

Is C checking the possible 4 strings?

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

    Yes, that's what I did.

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

    Checking 2 strings is enough. We have two longest (n-1 length) strings.

    One of them would be prefix and another will be suffix. Therefore, we can just guess one to be prefix and add a single char — last letter of another longest string — to the last of what we guessed. And if it isn't the case, we can do it again with another guess.

    This is valid because it is guaranteed that there is an answer.

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

      What is test 17 in C ?? I could not pass it. I firstly found strings of length n-1 in the input data and then considered if one of them could be a prefix of original string . Once I find that which one is prefix of length n-1 we can get the answer string but I can't understand where am I wrong MY SUBMISSION

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

      i solved it in the same way but getting wrong answer on test 17 .. i don't know what is the issue , i tried many different approaches all of them failed on test 17... let us assume i found the right string then i will iterate over all the prefixes and suffixes and store them in a vector in the form of pair of string and character and finally printing by just iterating over the input data and checking the other part of the pair and in case prefix == suffix i am handling that case too.

      edit: i was using find function to match the prefixes and suffixes which may fail for the case where it have different suffix(or prefix) but it matches with prefix as it is there so instead create another vector to store all of them and match them one by one this helped me :) hope this may help to others who failed on test 17...

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

      i have solved it like that but then also my solution has been hacked ...don't know why ??

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

wasn't div3 supposed to be easier then div2?

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

Is this a joke? The difficulty level rises up like bitcoin! Come on

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

how to solve D1 and D2 ?

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

i think problem c and d hard for div3 ?

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

What is test 17 in C ?? I could not pass it. I firstly found strings of length n-1 in the input data and then considered if one of them could be a prefix of original string . Once I find that which one is prefix of length n-1 we can get the answer string but I can't understand where am I wrong MY SUBMISSION

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

47221338

Why did this fail?

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

Problem E is IOI 2013 — Day 1 — Dreaming

Also, how to solve D1?

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

    In D1, from some state you can always add verticals on any column for as much as you'd like, since anyway you can return to the state before with all columns being increased by some constant C (which makes no difference).

    Therefor, you can always keep at a state where the difference between the maximal and minimal column is less than 2, this implies you can take all columns modulo 2.

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

    I used stack for D1. Because we can vertically add a block, the number actually doesn't matter — only its parity does. I just checked parity every time I get an input and if i-th element has same parity with i-1 th element, both can be raised to arbitrarily number, so I just ignored them.

    At last, if we have one or zero element left, we can complete the wall. Else, we can't.

    This was my idea, but I'm not really sure if this is correct or not. Plz teach me a lesson if you found something wrong :)

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

    I passed pretests by keeping a queue of all possible consecutive indices whose values have the same parity because they can be made to reach all possible heights. Removing a pair might add a new pair in the queue if then consecutive indices have same parity. If at the end, we have exhausted all possible indices except possibly any 1, then answer is yes, else no.

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

:(

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

Не посинел, потому что не успел наложить кирпичей

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

I think this contest is div1+div2 combined !

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

I think problem E can be solved in O(n), though I submitted an O(n*n) solution.

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

How to solve F ?

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

    Hint: Calculate values for each of the nodes using DP. Firstly calculate the value for just the subtree for each node using subtree values of the children. Then, calculate the complete value (for subtree + other nodes) using parent node complete value.

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

Me after open the scoreboard for today Div 3 round:

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

How to solve F?

I was trying to find the two nodes which lie at the diameter of the tree, I assumed that either of them will be the answer, but it was not to be. Can someone provide with a small test case where this assumption fails?

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

    Testcase: If diameter has the largest weight and rest are preety small maybe. Hint: use DP.

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

Problem D is a pile of bullshit.

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

Considering the low constraints, I don't think C was tough, it was good enough for Div3. I can say this until my code is not hacked. :P

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

    Felt same here. Initially I thought C was too tough for div3, requiring trie and some other skill. But I think 100 is fair constraint... Still I'm not sure before systest and hacks end :P

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

Is there any penalty for unsuccessful hack?

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

Anybody have idea for D1 pretest 9?

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

For D1 :

  1. Since we have vertical bars of length two, it means all odd numbers can be made same, and all even numbers can be made same.
  2. When a parity is occurring in even length, it can toggle its parity easily. This can be used to merge the neighboring segments of odd length into an even length segment. You can do this repeatedly.
  3. If you think more, the problem is same as given a binary string S, and if you can convert "11" into "1" and "010" into "1", then find if S can be merged down to either of {"1", "01", "10"}. The order of events is important here, for example if S = "0101000", and you perform "010" transformation at 0th index first, then you can never merge it down to "10". Does anyone know how to solve this problem?
»
5 лет назад, # |
  Проголосовать: нравится +70 Проголосовать: не нравится

When seeing problem C — F : Image and video hosting by TinyPic

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

D1 wasn't easy at all it's harder than most of div(2) C :/

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

    Maybe he tried to troll div 1-2 participants who tried to solve from the last problems.

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

      actually all div3 contests sucks they always fail to make a balanced problem set and I will never participate in a div3 round again

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

Whoa, challenging round for cyan here :) However, I really enjoyed. Although generally people here felt this was harder than how div.3 should be, I think it gave me more "doable" challenges than div2 rounds did. (Generally I couldn't even submit for problem D on a div2 round ...)

Thanks for vovuh and whoever worked hard to prepare a round, and to the community for giving wonderful oppertunity to enjoy problem-solving.

Hope no systest failures or hacks kill my rating xD

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

in problem C, test 17 gave me WA and when i changed the order of processing the input, it got AC. i don't know why. please someone help...

code1: https://codeforces.com/contest/1092/submission/47224002

code2: just by changing the order https://codeforces.com/contest/1092/submission/47227536 please someone check it...

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

    I have the same problem with test 14. I just changed order of appending strings with length 1 and length (n-1). Pretty sure that test for problem C isn't covers all possible answers.

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

    your code will probably get hacked

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

    Me to, i wrote cout<<"P" (or "S") and got wa on 17, but when I switched up and put answer in string, I got accepted.

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

Вопрос по взломам: они влияют на результаты матча или просто for fun? Какие бонусы/пенальти за успешный/неуспешный взлом? Если влияют, то справедливая ли это система? У меня, к примеру, нет возможности продолжать участие после окончания соревнования по причине нехватки времени, а кто-то может и 12 часов сидеть взламывать. Спасибо.

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

Because I'm so stupid, I can not do C problem

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

https://codeforces.com/profile/sxzdsb this guy has inserted if(n==66) print(some random no) into his code. please admin look into this

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

Though above the Div3 level, the problems were really good(I read A, B, C, F).

Can F be solved by doing multiple DFS?? Basically, after finding the answer for 1 index as root through 2 DFS, I tried to do another DFS and pass some parameters to check for it's children, but couldn't implement it in time. Am I thinking the right way?

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

    yes if you use dp with 2 times dfs.

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

    Yes. After finding the answer for an arbitrary vertice you can calculate the answer for any children of this node in constant time. Basicaly, when you move from from a vertice u to a vertice v you have to decrease the sum of values of all subtree of v (because the distance has decrease by one) and increase by the sum of all others nodes that doesn't in subtree of v (because the distance to this vertices has incressed by one).

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

    Yes, exactly the same idea (I used 3 dfs's). I implemented in time, was unable to debug a wrong indexing in dfs in time :(. It got accepted few mins after the contest got over... My submission: https://codeforces.com/contest/1092/submission/47228524

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

    Thanks! :)

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

Was this really for Div3 noobs?

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

Penatlty for unsuccessful hack?

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

"And for 1600-1899 the problems will be too easy."

I missed a really good contest because of this line :(

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

That moment when you submit a bunch of bullshit code in C and you get accepted.

https://codeforces.com/contest/1092/submission/47222677

Someone please hack me , end my suffering :p

I give it a chance of 70% to be hackable.

UPD : i got accepted lol.

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

    5 atmx a at tmxk mxk xk k atm for this test case your code gives segmentation fault..still unsuccessful hack

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

      Use custom invocation , the segmentation fault was probably caused by the compiler you are using.

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

Hi, Can someone please help me out with the solution for problem C? I got wrong ans on test case 17. After contest i swapped the order of processing the longest string and submitted and got AC.

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

    I think verdict is wrong. I had same problem and checked TC 17, it's oyyyyyyy.. (with 99 y). I checked on notepad and it's correct in both order (yyyyyyo or oyyyyyy)

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

      I think you are wrong. I checked your solution on the following case:

      Test

      And it printed PPPPSSSS while only one suitable string is "baaaa". So...

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

        Checked again and I might be looking some suffixes in reverse way :P

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

          Are you trolling me? Or what are you trying to say? I checked all your wrong submissions for this problem in custom invocation on this test and they're returned the wrong answer (in my and checker opinion).

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

            I'm not trolling you, was saying what was my mistake. Here an example: for aab, ab is suffix but when I was checking, sometimes I was looking it as "ba" (in custom inputs)

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

              Oh, then I'm sorry, I didn't understand you correctly.

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

    I had a similar situation as yours. If you are only checking for prefixes and assigning the remaining strings suffixes then it becomes important as to what you choose as prefix. Out of two largest length strings, it may seem both can satisfy prefixes but only one can satisfy suffixes. So as you change your order of processing, you may get AC on a wrong TC as you are changing your prefix. But you need to check suffixes also.

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

Any Ideas for an O(N) solution in E.

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

I tried to make strong tests — he said

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

https://codeforces.com/contest/1092/submission/47229976 The solution for D2, Can this be hacked. Just got hacked in my original D2 solution and found my mistake, I was just missing one simple condition. So I wanted to know can this be hacked now. Thanks

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

VERY HARD DIV3!

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

Saw a lot C's solutions are getting hacked. What are the hacks for C?

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

How to solve C Question? I'm guessing the full string using prefixes and suffixes of length n-1 and then if any string is a prefix of fullString it is assigned P and other one of same length is assigned P! I'm always failing on test 14 Please help!

My Submission

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

    in short:

    From the input you can get 4 candidate strings from which the suffixes and prefixes could come from. These 4 string are )for instance) combinations of 2 shortest and 2 longest strings from the input (shortest + longest or longest + shortest),

    Just check among these 4 a valid one and you solved the classification problem.

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

      Or you could just form 2 strings. Take the largest strings among the input strings, suppose s1 and s2. Two strings to be checked are:

      s1[0] + s2

      and

      s2 + s1[s1.length()-1]

      Example: 5 ba a abab a aba baba ab aba

      In this merge abab and baba to form: "ababa"(from a + baba) and "babab"(from baba + b) and check these 2.

      This works because the answer always exists.

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

        Yeah, actually this (your) is the solution I implemented, cause you just need to check 2 strings so I assumed it would run faster. Maybe my first explanation is a bit more intuitive,

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

          I have done the same in my submission!

          I can't figure what's wrong!

          Can any of you helpout?

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

Cheaters on problem D2 Duongcvp , duyleson76

47217201, 47216097

UPD: vovuh pelase look into it.

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

The rate at which my rank is decreasing, after 8 hours I will be rank 1.

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

Sorry, of course, but why is C such a slop? Maximum unpleasant. Do you like to give such tasks? ...

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

I dont think all the possible answers are provided in each testcase for checking. For example, in test case 19: 5 ba a baba a aba abab ab aba

Either ababa or babab can be the possible string. Thus, the possible answers are SPSSPPPS and PSPPSSSP respectively. But when my code output PSPPSSSP, the verdict was WA. Please look into this.

My submission: https://codeforces.com/contest/1092/submission/47238081

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

can someone explain why i fail test case 9 on D1? thanks.

submission 47221085

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

can someone explain why i fail test case 12 on C ?thanks. submission https://codeforces.com/contest/1092/submission/47223481

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

    Apparently according to the judge, it says "The number of 'P's and 'S's should be one and one for length 1". Maybe your output marks both strings of length 1 as P or S. One should be P and one should be S.

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

    When you check the Ps it seems you are assigning prefixes too early and leaving invalid suffixes

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

Man I solved problem C using DP , I was so proud because no one else did it that way (that I know of) and then I got hacked :( bummer, but of course I got hacked I didn't take into account at the last step of the DP to check that the remaining suffixes were valid , :( I really feel so hopeless about this contests I just get crushed over and over again, well at least I solved it using a different approach.

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

very weak pretests ever!! two of my solutions were hacked. This isn't fair actually. -_-

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

Fun fact: I hacked at least 40 submissions with a test that hacks my own submission for problem C :P

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

I think test case #17 for C is wrong.

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

The div3 is very good, E & F is about tree, let's know how to get diameter of the tree and how to construct the shortest diameter. and F is also nice, is similar with fermat point problem. https://www.lintcode.com/problem/fermat-point-of-graphs/

Thanks vovuh

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

System test did not happen? Or if it is going to happen, then when?

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

Where is the rating changes

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

I don't think that problem C is that hard solely because of constraints on n <= 100. Just find the strings of length n — 1 from the input. Consider one to be prefix and other one to be suffix. Find all other suffix and prefix strings from these strings and check wheather theses strings matches with the input , if not then the other possiblity must be the answer

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

i even think that F is easier than C

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

When is the rating going to change??

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

For problem C — Prefixes and Suffixes, my submission 47235377 got a MLE by using the built-in C++ sort function.

On the other hand, when replacing sort with stable_sort, the solution is accepted with only 200 KB of memory consumed 47237954.

Does anyone have a clue why this is the case?

Thanks in advance.

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

    Your compare function has undefined behaviour. Change return a.Id < b.Id; to return a.S.size() == b.S.size() && a.Id < b.Id; and you will get AC :)

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

isn't its a rated contest ???

why its took so much time to changing rating ?

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

I have one solution of C.Find two strings of length (n-1), assuming they are prefix and suffix, or suffix and prefix. Then let the other strings match the two strings. Because each length has only two strings, one is the prefix and the other must be the suffix. Because the problem must have a solution, if the first case is wrong, the other must be correct.

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

Why in test 23 of problem C, checker of system report "Runtime error" 47214009, when in my IDE or Custom Invocation, my code is alright with that test. (Test 23 is special case, so i can creat it myself). This is my code, include test 23 in input: https://ideone.com/PB83La

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

    vovuh Can you check the checker of problem C again ? Thank you!

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

      Test 23 has the following pattern:

      Spoiler

      Your pattern of test from ideone not matches this one. Anyway, I copy-pasted 23th test from polygon and checked your solution in custom invocation and it gives WA.

      I had read my checker in about 20 times. It is correct.

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

      mistake is in your code.
      check this in your sort comparator :-
      return (a.X.length()>=b.X.length());

      remove the equality sign and you will get AC, like this :-
      return (a.X.length()>b.X.length());

      for more details refer strict weak ordering

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

What means terms "improper prefixes" in Problem C? I guessed it means words which are not prefix of the given string.

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

Hi fellows, Why I still can not see my rating change of this round now?

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

)

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

Please update my rating for this contest, user name: dileepjallipalli29

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

It's been one day, no food, no water, no sleep. Still waiting for the rating to be updated

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

I am getting a Runtime error on test 4 for C. Can someone help? 47229206. I am guessing the word since we know both the suffix and prefix of length n — 1 , and then assign 'P's and 'S's accordingly.

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

    maybe variable word is empty.

    you can check it with asserts:

    string word;
       if(first[0] + last[0] == last[1] + first[1])
          word = first[0] + last[0];
       else if(first[0] + last[1] == last[0] + first[1])
          word = first[0] + last[1];
       else assert(0);
    

    try submit this code.

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

Are the ratings for this contest has been updated?. Because I can't see any changes in my ratings. I took part in this contest and solved 2 questions. Please update the ratings!!

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

Editorial?

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

deleted

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

y the hell is it taking this much time for changing ratings ?

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

Fastest system testing ever plus slowest rating update ever in my codeforces career.

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

Can anyone explain problem E?

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

    For each Tree, find its center (find the diameter first, and take the node in the middle of the path, that's the center). Let Cx be the center of one of the trees with greatest diameter. Now add an edge between Cx and every other center found, now you have created another tree in which the diameter's length is minimmum. Finding all centers can be done in O(N), and finding the diameter of the final tree can be done in O(N) as well, so the overall complexity remains O(N).

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

E — невероятно-красивая (хоть и баян).

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

The problem C is not so hard as it seems in my opinion, I solved it in the folowing way : take the two sequences of length n - 1, one is suppose to be the prefix and another the suffix of the original string and the original string is either a[0] + b or b[0] + a. Just try both possibilities and take the good one.

When taking a[0] + b you should check as well if the letters in a from position [1, size] are equal with the letters in b from [0, size - 1], same goes for b[0] + a.

Hope this helps somebody, for more details take a look at my submission.

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

Oops, what wrong with the winners? It seems to be Doma_Umaru only got rank 5 instead of 1 (I found on his/her profile), and absolutely_bu01th4nh got rank 1?

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

AbduM лучший

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

your previous round was one of the best rounds i've seen since i join codeforces

hope to see such a great contest again