清华营模拟赛 5.10

赛时时间安排

14:10-14:30 读题,T1为啥这么难懂啊

14:30-16:00 发现见过T3,就先去打T3了,打表后想起了这道题的结论,就愉快地码起了费用流,和一个根本不指望能拍出错的暴力拍了拍,就交了。

16:00-16:30 T2好懂一些,就先去码了30pts的暴力,码完后思索了十几分钟没思路,就跳了

16:30-17:30 费劲地码了个T1的60pts暴力,打完暴力后也知道T1的正解大概需要维护些什么东西,然而根本不会维护。

17:30-18:50 想着优化优化暴力的常数,骗点分,结果发现T1、T2的复杂度总有某个部分是卡死的,常数性/剪枝性的优化根本没有意义。

赛后反思

T3挂了15pts,发现这道题由于边权的特殊性,spfa的判断条件应为 dis[t]<0 而不是 pre[t]!=-1 ,以后打最大费用流时应该注意这个细节。

T3

题意

\([n]\)的一个子集,满足子集中元素互质,求其元素和的最大值。

\(n\leq 2\times 10^5\)

题目来源:雅礼集训2019DAY2/bzoj 3308九月的咖啡店/Euler355

题解

解决本题需要发现以下两个结论:

1.最优集合里每个数最多只有两个本质不同的质因数

2.若一个数含有两个不同质因子,则一定满足一个\(<\sqrt n\),一个\(>\sqrt n\)

然而全网都没人给出证明。。。

目前只有一个老哥给出了一个感性理解,附在下方

There are far more primes between √n and n than that between 1 and √n. No two of those larger primes can be in the same number since the product would be greater than n. But because the greater primes are so numerous, there are ways of making a number with one of them and some power of one small prime to get quite close to n. (For the n=200000 case of this problem, all of them get within a few thousand.) Because of this, any number that includes two or more of the small prime factors can never beat keeping the small prime factors separate. I used a greedy strategy, finding the large prime p for each small prime q where p*qr-p-qs was as large as possible, where r and s are the largest powers that keep each respective term under the limit. But there are some conflicts where different small primes want to use the same larger prime. These conflicts only occur for primes close to √n where each small prime is just being multiplied by a large prime. It is fairly easy to look at the list of large primes in these cases and find the next smaller nonconflicting prime, and then it works out for the best to take the smallest of the conflicting small primes and multiply it by the smaller nonconflicting prime. Multiplying large times large and small times small in these cases is optimal.

posted @ 2021-05-11 11:34  Robert_JYH  阅读(62)  评论(3编辑  收藏  举报