Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

keko37's blog

By keko37, history, 3 years ago, In English

Hi everyone!

The sixth round of COCI will be held tomorrow, April 9th at 14:00 UTC. You can access the judging system here. If you are not familiar with the COCI contest format, we encourage you to read the announcement.

The round was prepared by ominikfistric, Bartol, pavkal5, and me.

Feel free to discuss the problems in the comment section after the contest ends.

Hope to see you tomorrow!

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

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

It clashes with Educational Codeforces Round 126. I have tried to ask the author of the Educational Codeforces Round for rescheduling but maybe I am just a CM, there was no reply.

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

It consides with CF edu round, Can you change the time of it? keko37

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

    The dates for all COCI rounds are known from the start of each year, and it doesn't make sense to change it last second for a cf educational round (also applies the other way around, since much work and effort is put into each contest, and you wouldn't want to disrupt the schedule of thousands of participants — for iamttm's comment)

    If you favor one of the contests you can complete the other by yourself later, which I know isn't the same, but I think it's the best you can do right now...

    Of course it would be nice if the scheduling of contests on cf will be done with accordance to other major contests and events (which I think is already the case, at least partially), but there are simply too many contests for it to be possible :/

    Anyways good luck on whatever contest you choose to participate in!

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

Friendly reminder, the contest starts in less than an hour :)

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

seems i was the only full scorer this time :)

here are my solutions:

D
D code
E
E code
»
3 years ago, # |
Rev. 3   Vote: I like it +9 Vote: I do not like it

My solution for D:

Let's first solve the problem if we only have to print the answer after all the concatenations.

You can simulate the concatenations using a DSU by storing a deque of characters in each component.

Then after you have the final string, you can build a palindromic tree on it. The number of distinct palindromes in the string is just the number of nodes without the two roots.

To support answering after each concatenation, you can store a palindromic tree in each component in the DSU.

To do the merging, you only need to modify the palindromic tree so that it can add characters to the front and the end, and then you can merge two palindromic trees just like deques.

Notes for implementation: Normally, a palindromic tree supports adding a character to one of the ends. To support adding characters to both ends, you can store two pointers, the first points to the longest palindromic prefix, and the second points to the longest palindromic suffix. When merging, you need to be careful to preserve the order, e.g. when merging $$$x$$$ and $$$y$$$ you have to put the characters of $$$y$$$ after the characters of $$$x$$$ if $$$y$$$ has more characters or $$$x$$$ before $$$y$$$ is $$$y$$$ has more characters.