[BZOJ] [81] [Coci2015] [Divljak] [solution] [AC automatic mechanism], bzoj1_81

Source: Internet
Author: User

[BZOJ] [81] [Coci2015] [Divljak] [solution] [AC automatic mechanism], bzoj1_81

Door: http://www.lydsy.com/JudgeOnline/problem.php? Id = 3881

Thank you for your reminder.

Create an AC automatic machine for S and record the End Node of each string

Insert is to run it again on the fail tree, and put the node ans ++ that has not been accessed this time

Ask O (1)

If the link is attached to each vertex, the link will not be dropped.

Consider that all S are,

Then I have 10 ^ 5 inserts

Scan the chain once inserted, n ^ 2 ......

UPD:

Laruence says my approach is not complex ......

It's time to get a constant card.

Correct posture

UPD:

I found myself making a silly mistake and ran for more than 15 s.

After the change, rank1 was temporarily refreshed.

UPD:

Luye took me out.

Roll back to the classroom, study late, rewrite tomorrow

Remove my data (lu ye provides the idea TImeMachine for data,Not added to bzoj)

In the same way, lu ye only used 1 s +, and I used 10 s + ...... (Standard Process <1 s)

What is this? =,

Code:

No code posted

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.