相关链接
题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3930
神犇题解:http://www.cnblogs.com/iwtwiioi/p/4986316.html
解题报告
这题,仔细想一想,岂不是跟这个题一样:http://oi.cyo.ng/?p=498
于是答案就是这个东西:$ \sum\limits_{i = 1}^m {\sum\limits_{j = 1}^m { \cdots \sum\limits_{k = 1}^m {[gcd(i,j, \cdots ,k) = K]} } } = \sum\limits_{i = 1}^{\left\lfloor {\frac{m}{K}} \right\rfloor } {\sum\limits_{j = 1}^{\left\lfloor {\frac{m}{K}} \right\rfloor } { \cdots \sum\limits_{k = 1}^{\left\lfloor {\frac{m}{K}} \right\rfloor } {[gcd(i,j, \cdots ,k) = 1]} } } = \sum\limits_{d = 1}^{\left\lfloor {\frac{m}{K}} \right\rfloor } {\mu (d) \cdot {{\left\lfloor {\frac{m}{{Kd}}} \right\rfloor }^n}}$
于是剩下的锅就是预处理莫比乌斯函数的前缀和了!
然而我只会 $ O(n)$ 的做法,于是就跪了
PoPoQQQ大爷给了一种神奇的做法:http://blog.csdn.net/popoqqq/article/details/44917831
大概就是说,莫比乌斯函数的前缀和可以进行如下变换:
$ \sum\limits_{i = 1}^n {\mu (i) = 1 – \sum\limits_{i = 2}^n {(0 – \mu (i)) = } 1 – \sum\limits_{i = 2}^n {(\sum\limits_{j|i} {\mu (j)} – \mu (i))} = 1 – \sum\limits_{i = 2}^n {\sum\limits_{j|i,i \ne j} {\mu (j)} } } = 1 – \sum\limits_{j = 1}^n {\mu (j) \cdot (\left\lfloor {\frac{n}{j}} \right\rfloor – 1)} = 1 – \sum\limits_{j = 1}^{\left\lfloor {\frac{n}{2}} \right\rfloor } {\mu (j) \cdot (\left\lfloor {\frac{n}{j}} \right\rfloor – 1)}$
换一句话说,莫比乌斯函数的前缀和可以做到 $ O(\sqrt n \log n)$
这样的话,感觉复杂度是 $ O(n \log n)$ 的
然而PoPoQQQ大爷说,预处理前 $ S$ 个值的话,复杂度就可以变成:$ O(\frac{n}{S}\sqrt n lo{g_2}\frac{n}{S})$
然而并不知道怎么证明,感觉很有道理的样子!
当然这题还有容斥的做法
首先有结论:$ gcd(i,j) \le (r – l),(i,j \in (l,r))$
证明的话,参见这里:https://blog.sengxian.com/solutions/bzoj-3930
于是考虑 $ f(i)$ 表示gcd为i的方案数,则 $ f(i) = {\left\lfloor {\frac{m}{{Ki}}} \right\rfloor ^n} – \sum\limits_{i|j} {f(j)}$
这样的话, $ f(1)$ 就是答案辣!
—————————— UPD 2017.2.20 ——————————
突然发现,莫比乌斯函数的前缀和不是杜教筛的模板题吗?
当然PoPoQQQ的做法也有可取之处:不用复杂度公式推导
Im obliged for the blog article.Really looking forward to read more. Cool.
Really appreciate you sharing this article. Want more.
Appreciate you sharing, great blog. Keep writing.
I really liked your blog.Much thanks again. Awesome.
Thanks for sharing, this is a fantastic blog article.Really thank you! Really Great.
Muchos Gracias for your blog.Really thank you! Much obliged.
Thank you for your blog article. Awesome.
Great article.Thanks Again. Really Great.
Major thankies for the blog post.Really thank you! Much obliged.
Im thankful for the post. Great.
I appreciate you sharing this blog article.Much thanks again.
Major thankies for the article.Really looking forward to read more. Want more.
Say, you got a nice article.Much thanks again. Really Cool.
A big thank you for your blog post.Much thanks again. Cool.
Enjoyed every bit of your article. Keep writing.
Thanks a lot for the post.Thanks Again. Really Cool.
I really enjoy the article post. Really Great.
Major thanks for the article post.Thanks Again. Really Cool.
Thanks so much for the blog article.Much thanks again. Keep writing.
Thanks for the blog article.Really thank you! Keep writing.
Appreciate you sharing, great blog.Much thanks again. Keep writing.
Im thankful for the post.Thanks Again. Will read on…
Say, you got a nice article.Thanks Again. Really Cool.
Looking forward to reading more. Great blog post.Really looking forward to read more. Want more.
I really like and appreciate your blog post.Really looking forward to read more. Keep writing.
I truly appreciate this blog article. Great.
Appreciate you sharing, great blog article.Much thanks again. Much obliged.
Im thankful for the post.Really thank you! Fantastic.
I really liked your blog. Cool.
Im obliged for the post. Great.
Muchos Gracias for your blog article. Really Cool.
wow, awesome blog post. Keep writing.
wow, awesome post. Much obliged.
I really liked your blog article.Really thank you! Really Cool.
I am so grateful for your post.Thanks Again. Great.
Looking forward to reading more. Great blog. Want more.
I appreciate you sharing this blog article.Really thank you! Great.
Enjoyed every bit of your blog.Much thanks again. Keep writing.
What’s up friends, how is the whole thing, and what you desire
to say on the topic of this post, in my view its genuinely remarkable
in support of me.
I cannot thank you enough for the blog post. Cool.
I am so grateful for your article.Much thanks again.
I am really loving the theme/design of your weblog.
Do you ever run into any web browser compatibility problems?
A small number of my blog audience have complained about my website
not working correctly in Explorer but looks great in Firefox.
Do you have any solutions to help fix this problem?
Very informative article post.Really looking forward to read more. Really Great.
Thanks again for the blog.Really looking forward to read more. Great.
Thank you for the auspicious writeup. It in reality used to be a
leisure account it. Glance advanced to far
added agreeable from you! By the way, how could we keep
in touch?
Great, thanks for sharing this post.Thanks Again. Want more.
Thanks for sharing, this is a fantastic blog.Really thank you! Want more.
Appreciate you sharing, great blog post.Thanks Again. Cool.
I cannot thank you enough for the blog article.Really thank you! Awesome.
Hey, thanks for the article.Really thank you! Much obliged.
I truly appreciate this post.Thanks Again.
Im obliged for the article post.Really looking forward to read more. Will read on…
Major thanks for the post.Really looking forward to read more.
Im thankful for the blog article. Cool.
I really like and appreciate your article post.
Very informative blog.Thanks Again.
Really enjoyed this blog article. Want more.
Thank you for the good writeup. It in fact was a amusement account it.
Look advanced to far added agreeable from you! By the way, how can we communicate?
I really enjoy the blog.Really looking forward to read more. Will read on…
Hey, thanks for the article.Much thanks again. Great.
wow, awesome article.Really thank you! Want more.
Really appreciate you sharing this blog post.Really thank you! Keep writing.
Thanks for the blog.Thanks Again. Awesome.
Really enjoyed this article.Really looking forward to read more. Fantastic.
Really appreciate you sharing this article post.Really thank you! Want more.
Excellent pieces. Keep posting such kind of info on your blog.
Im really impressed by it.
Hey there, You’ve done a great job. I will certainly digg it
and in my view recommend to my friends. I’m confident they will be benefited from this website.
I have read so many articles or reviews on the topic of the blogger lovers
however this post is actually a fastidious paragraph, keep it up.
Im obliged for the article. Great.
Thanks again for the blog article.Really thank you! Want more.
Thank you for your post.Much thanks again. Will read on…
Great blog post.Really looking forward to read more. Awesome.
I every time emailed this web site post page to all my
associates, for the reason that if like to read it then my friends will too.
A round of applause for your blog article.Really thank you! Awesome.
Thanks-a-mundo for the blog article.Much thanks again. Much obliged.
My brother suggested I might like this web site.
He was totally right. This post truly made my day.
You can not imagine simply how much time I had spent for
this info! Thanks!
Major thanks for the article post. Much obliged.
Great, thanks for sharing this blog post.Much thanks again.
This is one awesome blog post. Much obliged.
Thanks a lot for the blog.Much thanks again. Will read on…
Thank you for your article post.Really thank you! Cool.
Great, thanks for sharing this post.Really thank you! Much obliged.
Very informative post.Thanks Again. Keep writing.
Very good blog article.Really thank you! Much obliged.
I am truly pleased to glance at this weblog posts which consists
of tons of valuable facts, thanks for providing such information.
I truly appreciate this post.Much thanks again. Great.
Im obliged for the blog.Thanks Again. Awesome.
Major thankies for the blog post.Much thanks again. Keep writing.
I think this is one of the most vital information for me.
And i’m glad reading your article. But want to remark on few general things, The website style is wonderful,
the articles is really excellent : D. Good job, cheers
I loved your blog post.Thanks Again. Really Cool.
Thank you for your article.
Thank you ever so for you blog.Thanks Again. Fantastic.
I am so grateful for your blog article.Thanks Again. Awesome.
I value the blog article.Really thank you! Really Great.
I really like and appreciate your blog post.Much thanks again. Awesome.
Really enjoyed this blog article.Much thanks again. Want more.
Thanks for the article post.Really thank you! Much obliged.
Good respond in return of this query with real arguments and explaining everything on the topic of
that.
Thanks for sharing, this is a fantastic blog article. Cool.
We’re a group of volunteers and opening a new scheme in our community. Your website offered us with valuable information to work on. You have done an impressive job and our whole community will be thankful to you.
I really like and appreciate your blog article.Thanks Again. Want more.
I loved your article post.Thanks Again. Will read on…
Im obliged for the article post. Really Great.
I really liked your blog article. Awesome.
Im obliged for the blog article.Thanks Again. Fantastic.
This web site truly has all the information I needed concerning this subject and didn’t know who to ask.
Thanks for sharing, this is a fantastic blog.Thanks Again. Will read on…
Thanks a lot for the article post.Really looking forward to read more. Want more.
Thanks a lot for the blog.Much thanks again.
Very neat blog article.Really thank you! Really Cool.
Very informative blog article.Really thank you!
I loved your post.Thanks Again. Will read on…
I value the blog article.Really thank you! Cool.
Muchos Gracias for your blog.Much thanks again. Will read on…
Thanks-a-mundo for the article.Really thank you! Really Cool.
Major thankies for the post.Really looking forward to read more. Awesome.
Say, you got a nice article.Really looking forward to read more. Keep writing.
I loved your article post. Much obliged.
Very informative blog.Thanks Again. Fantastic.
A round of applause for your post. Really Cool.
Say, you got a nice post. Will read on…
I really liked your blog.Really looking forward to read more. Great.
A round of applause for your article.Really looking forward to read more. Cool.
Enjoyed every bit of your post. Great.
Hey, thanks for the blog.Really thank you! Fantastic.
I got this website from my buddy who informed me on the topic of this web site and
now this time I am visiting this website and reading very informative posts at this place.
Very neat blog article.Really thank you! Really Cool.
Thanks a lot for the post.Much thanks again. Will read on…
Im thankful for the blog post.Really looking forward to read more. Awesome.
Really enjoyed this article.Really thank you! Cool.
Someone necessarily assist to make seriously posts I would state.
This is the very first time I frequented your website page and
so far? I surprised with the research you made to create this actual
publish extraordinary. Magnificent process!
Hey, thanks for the blog article.Thanks Again. Really Great.
Link exchange is nothing else but it is simply placing the other person’s
webpage link on your page at suitable place and other
person will also do same in support of you.
Awesome blog post.Really thank you! Really Cool.
I really enjoy the article.Really thank you! Awesome.
Major thanks for the article post.Much thanks again. Fantastic.
Terrific work! That is the type of information that should
be shared around the net. Shame on the seek engines for no longer positioning this put up higher!
Come on over and talk over with my website .
Thanks =)
A big thank you for your article post.Much thanks again. Really Cool.
Looking forward to reading more. Great post.Really looking forward to read more. Really Great.
Great blog post.Thanks Again. Great.
A big thank you for your post. Great.
I value the post.Thanks Again. Cool.
Great, thanks for sharing this blog post. Fantastic.
Really enjoyed this blog article.Really looking forward to read more. Want more.
Say, you got a nice blog article.Much thanks again. Really Cool.
Very good post.Really thank you! Fantastic.
Awesome article post. Cool.
Fantastic article.Really looking forward to read more. Really Great.
Heya i am for the primary time here. I came across
this board and I in finding It truly useful & it helped me
out much. I hope to provide one thing back and help others such
as you helped me.
I really liked your blog article.Really thank you! Really Great.
I really liked your post.Thanks Again. Keep writing.
I truly appreciate this article.Much thanks again. Really Cool.
I really enjoy the post.Really thank you! Keep writing.
I cannot thank you enough for the blog article.Much thanks again. Cool.
A big thank you for your article.Really thank you! Want more.
Thank you ever so for you article. Really Cool.
Im thankful for the article post.Really looking forward to read more. Great.
My brother suggested I might like this blog. He was entirely right.
This post actually made my day. You can not imagine simply how much time I had spent for this info!
Thanks!
Thank you for your blog article.Really thank you!
A round of applause for your blog post.Much thanks again. Much obliged.
Im thankful for the post. Will read on…
I need a good fate to see this blog. I am really happy.
Im thankful for the post.Much thanks again. Really Cool.
Very neat article.Really thank you! Will read on…
Fantastic blog post.Really looking forward to read more. Will read on…
Really appreciate you sharing this blog post.Really thank you! Much obliged.
Thanks so much for the blog post.Thanks Again. Really Great.
Thanks for the article.Thanks Again. Cool.
I am so grateful for your article.Really looking forward to read more. Cool.
I truly appreciate this blog.Much thanks again. Will read on…
You should be a part of a contest for one of the highest
quality blogs on the net. I will recommend this site!
A round of applause for your blog.Much thanks again. Really Great.
Thanks for the post. Will read on…
Im thankful for the blog post.Really thank you! Really Cool.
Appreciate you sharing, great blog article.Really looking forward to read more. Keep writing.
Really enjoyed this blog article.Much thanks again. Awesome.
Thank you ever so for you article.Thanks Again.
I really like and appreciate your blog.Really thank you! Cool.
Thanks for sharing, this is a fantastic article post.Really looking forward to read more. Want more.
Thanks for the blog post.Thanks Again. Fantastic.
I really liked your blog. Will read on…
I loved your blog post.Thanks Again. Much obliged.
Very good article.Really thank you! Much obliged.
Thanks-a-mundo for the blog article. Fantastic.
I value the article.Much thanks again. Great.
I really enjoy the article post.Really thank you! Keep writing.
I think this is a real great article post. Keep writing.
I really liked your blog post.
I value the blog.Much thanks again. Awesome.
Wow, great blog article.Thanks Again. Really Great.
I loved your blog article. Want more.
Thanks-a-mundo for the article. Fantastic.
I truly appreciate this article post.Really thank you!
Say, you got a nice blog.Really looking forward to read more. Will read on…
This is one awesome article.Really looking forward to read more. Much obliged.
Thanks again for the article.Thanks Again. Cool.
Enjoyed every bit of your article post.Really thank you! Will read on…
wow, awesome post.Thanks Again. Will read on…
Great, thanks for sharing this post. Really Cool.
I really enjoy the blog.Really thank you! Great.
Hey, thanks for the blog article.Thanks Again. Cool.
Hey, thanks for the article post.Really looking forward to read more. Much obliged.
A big thank you for your article post.Thanks Again. Keep writing.
I think this is a real great article post.Really looking forward to read more. Will read on…
Thank you for your article.Much thanks again. Great.
Thank you ever so for you blog post.Much thanks again.
Thank you ever so for you article post.Really thank you! Much obliged.
Enjoyed every bit of your blog article. Keep writing.
Very neat article post.Really thank you! Want more.
I really enjoy the blog post.Thanks Again. Great.
Looking forward to reading more. Great blog.Really looking forward to read more. Will read on…
Along with almost everything which appears to be developing within this subject matter, many of your opinions tend to be rather radical. Nevertheless, I appologize, but I can not give credence to your whole idea, all be it refreshing none the less. It would seem to us that your comments are not entirely validated and in actuality you are yourself not totally convinced of your assertion. In any event I did appreciate looking at it.
I value the blog post.Really looking forward to read more. Will read on…
Hey there just wanted to give you a quick heads up.The words in your content seem to be runningoff the screen in Chrome. I’m not sure if this is a formatting issueor something to do with web browser compatibility but I thought I’d post to letyou know. The design look great though! Hope you get the problem fixed soon. Kudos
What i do not realize is in fact how you’re not really a lot more neatly-preferred than you may be right now. You are so intelligent. You understand thus significantly in relation to this topic, made me in my view consider it from so many numerous angles. Its like women and men don’t seem to be involved until it is one thing to accomplish with Woman gaga! Your own stuffs nice. All the time take care of it up!
Say, you got a nice blog article. Cool.
Very good article.Much thanks again. Awesome.
Great post. Fantastic.
thank you web site admin
I think this is a real great article post. Cool.
I am so grateful for your article.Really looking forward to read more. Cool.
Great, thanks for sharing this article.Really thank you! Great.
Great article. Cool.
Very good blog article.Really thank you! Great.
[url=http://phenergan24.com/]phenergan[/url] [url=http://femaleviagra2019.com/]female viagra[/url] [url=http://valtrex100.com/]buy generic valtrex online canada[/url] [url=http://propranolol100.com/]propranolol[/url] [url=http://advair2019.com/]buy advair[/url]
Appreciate you sharing, great blog.Much thanks again. Much obliged.
Say, you got a nice article.
Hey, thanks for the post. Cool.
Thank you for your article post.Much thanks again. Much obliged.
Thanks-a-mundo for the post.Thanks Again. Great.
Im thankful for the blog article. Keep writing.
A round of applause for your blog.Thanks Again. Fantastic.
How long does a copyright last on newspaper articles?. . If a service copies newspapers articles and then posts it in a database on the Internet, is there also a copyright on the Internet content?.
Really appreciate you sharing this blog.Much thanks again. Really Cool.
I think this is a real great blog post. Great.
I am regular visitor, how are you everybody? This article posted at this website is actually nice.|
Terrific article! That is the kind of info that are supposed to be shared across the internet. Shame on the seek engines for now not positioning this publish upper! Come on over and seek advice from my site . Thank you =)|
Say, you got a nice blog post.Really looking forward to read more. Really Cool.
I really enjoy the blog article.Really looking forward to read more. Really Great.
After looking into a few of the blog articles on your web page, I really appreciate your technique of writing a blog. I added it to my bookmark website list and will be checking back soon. Please check out my web site as well and let me know how you feel.|
Im thankful for the article. Want more.
Very neat blog article.Thanks Again. Cool.
Hey! Do you know if they make any plugins to assist with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results. If you know of any please share. Thank you!|
Very informative blog post.Really looking forward to read more. Really Great.
Say, you got a nice blog article.Really thank you! Want more.
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?|
Major thanks for the blog.Really looking forward to read more. Want more.
Great blog article.Really looking forward to read more. Really Great.
Thank you for some other informative website. Where else may just I am getting that kind of info written in such an ideal approach? I’ve a mission that I’m just now operating on, and I’ve been at the glance out for such information.|
Thanks a lot for the blog post.Much thanks again. Great.
Awesome blog.Really thank you! Cool.
Im obliged for the blog article.Much thanks again. Keep writing.
Thanks for sharing, this is a fantastic article.Really thank you! Much obliged.
I’m curious to find out what blog platform you are utilizing? I’m having some minor security issues with my latest site and I would like to find something more safeguarded. Do you have any solutions?|
Very neat blog article.Really thank you! Much obliged.
Enjoyed every bit of your post.Much thanks again. Will read on…
all the time i used to read smaller articles or reviews which as well clear their motive, and that is also happening with this paragraph which I am reading here.|
Looking forward to reading more. Great blog article.Really looking forward to read more. Will read on…
Very good blog.Much thanks again. Much obliged.
Very neat article post.Really thank you! Will read on…
Woah! I’m really digging the template/theme of this website. It’s simple, yet effective. A lot of times it’s challenging to get that “perfect balance” between superb usability and visual appearance. I must say that you’ve done a very good job with this. In addition, the blog loads very quick for me on Firefox. Excellent Blog!|
I was suggested this web site through my cousin. I’m no longer certain whether this post is written by him as no one else recognize such detailed about my problem. You are wonderful! Thank you!|
I don’t even know how I ended up here, but I thought this post was good.I do not know who you are but certainly you are going toa famous blogger if you are not already Cheers!
This design is steller! You most certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!|
I am so grateful for your post.Much thanks again. Cool.
Today, I went to the beachfront with my children. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!|
Wow, great blog post.Really thank you! Awesome.
This is one awesome blog post.Thanks Again. Really Great.
Major thanks for the blog article.Really looking forward to read more. Fantastic.
This is one awesome article.Much thanks again. Awesome.
wow, awesome article.Thanks Again.
I really liked your post.Really looking forward to read more. Will read on…
Awesome blog article. Keep writing.
This post is worth everyone’s attention. Where can I find out more?|
Thanks a lot for the blog article.Much thanks again. Awesome.
Hey, thanks for the article post.Really thank you! Will read on…
I’m really inspired together with your writing talents as well as with the structure for your weblog. Is that this a paid subject or did you modify it your self? Anyway stay up the excellent high quality writing, it is uncommon to peer a great weblog like this one these days..|
Good day! I know this is kinda off topic nevertheless I’d figured I’d ask. Would you be interested in exchanging links or maybe guest writing a blog post or vice-versa? My website goes over a lot of the same subjects as yours and I think we could greatly benefit from each other. If you happen to be interested feel free to shoot me an e-mail. I look forward to hearing from you! Terrific blog by the way!|
I’m really impressed along with your writing skills as well as with the layout on your blog. Is this a paid subject or did you customize it yourself? Anyway keep up the nice high quality writing, it’s uncommon to look a nice blog like this one today..|