【CDOJ 1314】Hash Perfectly

相关链接

题目传送门:http://acm.uestc.edu.cn/#/problem/show/1314
神犇题解:http://www.cnblogs.com/qscqesze/p/5380044.html

解题报告

最开始想用暴力搞一搞
然后搞了两个小时,发现问题越来越多
还是来想正解吧 QwQ

考虑冲突的条件是什么: $a \equiv b({\mathop{\rm Mod}\nolimits} p)$
化简一下就是: $a – b = k \cdot p$
换一句话来说,对于给定模数$p$, 我们只要统计出有多少$a-b$等于$p$的倍数就好
这里暴力的话,用调和级数证一证就是 $O(nlogn)$ 的
于是现在问题变成了求$a-b=x$的有多少对了
我们发现这货搞一发$FFT$就可以啦!

18 thoughts to “【CDOJ 1314】Hash Perfectly”

  1. Spot on with this write-up, I truly believe
    that this amazing site needs a great deal more attention. I’ll probably be returning to read through more,
    thanks for the information!

  2. Hi there it’s me, I am also visiting this web site regularly, this website is truly pleasant and
    the visitors are actually sharing nice thoughts.

  3. Appreciating the time and effort you put into your blog and in depth information you provide.

    It’s great to come across a blog every once in a while that isn’t the same
    outdated rehashed material. Great read! I’ve bookmarked your site and
    I’m including your RSS feeds to my Google account.

  4. naturally like your web-site but you need to check
    the spelling on quite a few of your posts. Many of
    them are rife with spelling issues and I to find it very troublesome to inform the reality nevertheless
    I will certainly come back again.

  5. Those are yours alright! . We at least need to get these people stealing images to start blogging! They probably just did a image search and grabbed them. They look good though!

  6. Nice post. I was checking constantly this weblog and I’m inspired!
    Extremely useful info specifically the final phase 🙂 I
    handle such information much. I was looking for this certain info for a long time.
    Thanks and best of luck.

  7. I’ve been surfing online more than 3 hours as of late, yet I never discovered any interesting article like yours.
    It is lovely value enough for me. In my view, if all web owners and
    bloggers made good content as you probably did, the web can be a lot more useful than ever before.

  8. You are so awesome! I do not suppose I’ve read a single
    thing like that before. So great to find someone with a few unique thoughts on this subject matter.
    Seriously.. thank you for starting this up.
    This site is one thing that is needed on the web,
    someone with some originality!

  9. Hello there, You’ve done an excellent job. I’ll certainly digg it
    and personally suggest to my friends. I’m confident they’ll
    be benefited from this website.

  10. After I initially left a comment I appear to have clicked the -Notify
    me when new comments are added- checkbox and now every time a comment is added
    I recieve 4 emails with the same comment. Is there an easy method
    you can remove me from that service? Many thanks!

  11. Hello! This post could not be written any better!

    Reading this post reminds me of my old room mate!
    He always kept chatting about this. I will forward this article to him.
    Pretty sure he will have a good read. Thank you for sharing!

  12. of course like your web site but you need to test the spelling on several of your posts. Several of them are rife with spelling issues and I in finding it very bothersome to tell the reality then again I?¦ll certainly come back again.

Leave a Reply

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