1 2 3 4
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页
摘要: https://ac.nowcoder.com/acm/contest/7225/A 一句话,按照list转一圈,把list按照list转之后就是转两圈,快速幂的思想 #include<iostream> #include<algorithm> #include<cstring> #include< 阅读全文
posted @ 2020-09-05 20:38 Lesning 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 博弈论 https://codeforces.com/contest/1397/problem/D 如果随便取走,只要是奇数就是先手赢,现在他规定不能重复取前人取过的,那就意味着8 2 2 2 ,先手占领8,就必胜了,如果4 4 4 4 4 这样均势,a先手每次找最大的取,只要是奇数就能赢 想不到啊 阅读全文
posted @ 2020-09-04 17:00 Lesning 阅读(216) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/7079/C 由题可知是最小生成树,先把比L【i】小的连通块建立好,合并集合x,y可得 》 par[y] = x,ans += siz[x]*siz[y],siz[x] += siz[y]; #include<iostream> 阅读全文
posted @ 2020-09-03 22:24 Lesning 阅读(230) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1400/problem/D i<j<k<l 假设x = list【j】 y = list【k】 可以枚举j和k,0 j-1有a个y,k+1 -- n有b个x,ans+=a*b枚举就好了 具体看代码 #include<iostream> 阅读全文
posted @ 2020-09-03 21:25 Lesning 阅读(204) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1400/problem/B 有一点很重要,s能用完就一定会用完,枚举我用几个s就好 #include<iostream> #include<cstring> #include<queue> #include<algorithm> usi 阅读全文
posted @ 2020-09-03 15:17 Lesning 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 树上启发式合并 枚举每个数字的所有因子,存起来 官方题解传送门 https://ac.nowcoder.com/discuss/485120?type=101&order=0&pos=2&page=1&channel=-1&source_id=1 题目传送门 https://ac.nowcoder. 阅读全文
posted @ 2020-08-24 23:10 Lesning 阅读(179) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/5205/B 他给你的算法可以转换成重0,0除法到x,y有多少种走法在t个时间里,每个时间选择上,右或者不动 C(t,x+y)*C(x+y,x) #include<iostream> #include<algorithm> #i 阅读全文
posted @ 2020-08-23 18:07 Lesning 阅读(115) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/6037/F 很诡异,对于8 3 2 1 1这种,答案是7(3+2+1+1), 对于6 5 4 3 2 1这种,是(6+5+4+3+2+1)/2 所以求出每种颜色的最大数量 还有颜色总数就能在O(1)算出来一棵树了。但是吧。。。 阅读全文
posted @ 2020-08-20 17:30 Lesning 阅读(140) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/7016/E 这题真没想到 考虑一个问题,删除边对极差的影响, 无论如何删除边都有办法不让让答案变大(可能相等) 利用二分答案,每次算出mid都跑一次dp看看能不能k条边以内完成,dp[x][i]表示以x为根的子树,所有点的数值 阅读全文
posted @ 2020-08-20 00:47 Lesning 阅读(113) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/551/D 单调栈的神仙题,真的nb 想法很简单,例如dcaad, 1 d 2 d > c (后面还有d,可以弹出d,然后再放置c) 3 c > ca (后面没有c了,不能弹出c) 4 ca -- > ca (a在栈里不管他) 阅读全文
posted @ 2020-08-14 01:22 Lesning 阅读(91) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页