【BZOJ 4810】[YNOI2017] 由乃的玉米田

相关链接

题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4810
神犇题解:http://blog.csdn.net/qzh_1430586275/article/details/69400458

解题报告

看一看似乎一脸懵逼啊
询问两数相加、相减为特殊值不是只能$FFT$吗?
你这™还带区间限制,那怎么做啊……

但仔细看看值域范围,发现这货只有$10^{10}$
配上$30s$的限制,刚好是$bitset$的数据范围啊!
于是仔细想一想,加法可以直接减法可以直接左移然后$and$起来
至于减法,我们可以记一下负数就可以转化为减法了
至于相乘嘛,我们可以暴力枚举因数!
于是再配上区间的莫队,时间复杂度:$O(n \sqrt{n} + \frac{mc}{64})$

2 thoughts to “【BZOJ 4810】[YNOI2017] 由乃的玉米田”

  1. Hi there very nice web site!! Guy .. Excellent .. Superb .. I’ll bookmark your web site and take the feeds additionallyKI’m glad to find numerous helpful information right here in the post, we’d like develop extra techniques on this regard, thanks for sharing. . . . . .

Leave a Reply

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