【LA 5524】[EC2015 Final] Suffixes and Palindromes

相关链接

题目传送门:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5524

题目大意

给出一个串的$sa$数组和$manacher$求出的那个数组
请你构造出一个字典序最小的符合条件的串,可能无解

有$T(T \le 100)$组数据
数组长度$\le 10^5$
时间限制:$4s$

背景

Claris给我安利的题,似乎子问题都会的样子
但合起来就不会了

解题报告

考虑$manacher$的那个数组,实际上是给出了$O(n)$条信息
每一条信息形如:第$i$个字符(不)等于第$j$个字符
如果只有这个条件的话,我们可以搞成几个大连通块,然后贪心

考虑$sa$数组,上午才做了这个题
也可以直接贪心

但这两货直接合在一起,似乎是给出一个差分约束系统
然后让你输出一组可行解,还要让你字典序最小
于是就不会了

但我们还是考虑直接在$SA$数组上贪心
考虑回文等价的影响的话,那实际上是填一位就会影响后面的很多位
似乎想一想,直接贪心会不会使一个区间的两头被值域给卡住
但仔细想一想,即使你给那一个等价类一个大一点的字符,区间的差分序列没有变啊
该卡住的还是会卡住,没被卡住的也不会有问题

于是我们任然在SA数组上贪心,考虑能不能与前一个数相等的时候
不仅考虑$rank$数组的影响,我们还需要考虑回文等价的影响
于是这题就这么做完啦,仍然是一个$O(n)$的贪心

25 thoughts to “【LA 5524】[EC2015 Final] Suffixes and Palindromes”

  1. I believe everything published made a ton of sense. But,
    what about this? suppose you were to write a killer title?
    I am not suggesting your content is not solid, however what if you added a post title to possibly grab a person’s attention? I mean 【LA 5524】[EC2015 Final] Suffixes and Palindromes – Qizy's Database is a little plain. You should peek at Yahoo’s home page and see how they write news headlines to get
    people interested. You might add a video or a
    picture or two to grab people excited about what you’ve written.
    In my opinion, it could make your blog a little livelier.

  2. We’re a gaggle of volunteers and starting a brand new scheme in our community.
    Your site provided us with valuable information to work on. You’ve done an impressive task and our whole group
    might be grateful to you.

  3. Oh my goodness! Incredible article dude! Thank you, However I am having issues with your RSS.
    I don’t understand why I cannot join it. Is there
    anyone else having identical RSS problems?
    Anybody who knows the answer can you kindly respond?
    Thanx!!

  4. This is very interesting, You’re a very skilled blogger.
    I have joined your rss feed and look forward to seeking more
    of your magnificent post. Also, I’ve shared your web site in my social networks!

  5. Do you have a spam problem on this blog; I also am a
    blogger, and I was curious about your situation; many of us have created some nice methods and we are looking to exchange strategies
    with others, be sure to shoot me an e-mail if interested.

  6. After looking into a handful of the blog posts on your website, I really like your
    way of writing a blog. I saved as a favorite it to my bookmark website list
    and will be checking back in the near future. Take a look
    at my website too and let me know what you think.

  7. An outstanding share! I have just forwarded
    this onto a co-worker who had been doing a little research on this.
    And he actually bought me dinner due to the
    fact that I stumbled upon it for him… lol.
    So let me reword this…. Thanks for the meal!!
    But yeah, thanx for spending some time to talk about this subject here on your site.

  8. I got this web page from my buddy who told me on the topic
    of this web page and at the moment this time I am visiting this
    web page and reading very informative content here.

  9. of course like your website but you need to test the spelling on quite a few of your posts.

    A number of them are rife with spelling problems and I
    find it very bothersome to tell the reality then again I’ll certainly come again again.

  10. Attractive portion of content. I just stumbled upon your website and in accession capital to assert that I get actually enjoyed account your weblog posts. Any way I will be subscribing on your feeds and even I achievement you get entry to persistently rapidly.

Leave a Reply

Your email address will not be published. Required fields are marked *