随笔分类 - 算法竞赛
ACM/ICPC/CCPC
摘要:xor序列 线性基 题目链接 题意: 给你 \(n\) 个数,接着给你 \(m\) 次询问,每次给出 \(x\) 和 \(y\) ,判断 \(x\) 能否与 \(n\) 个数中任意选出的数异或和为 \(y\) 思路: 考虑异或运算性质 若 \(a\) ^ \(b\) = \(c\) , 那么 \(b
阅读全文
摘要:P4570 [BJWC2011] 元素 线性基 题目链接 题意: 给你每种矿石的编号和魔力值,你可以选择炼制一些矿石,如果一些矿石的编号异或和为0,那么该部分魔力值将为0。求出能够炼制的最大魔力值之和。 思路: 线性基+贪心。我们将每种矿石按照魔力值从大到小考虑,每次如果已经选过的矿石编号异或和不能
阅读全文
摘要:线性基模板 线性基是一种擅长处理异或问题的数据结构 可以O(logn)求出异或最值和异或k大值 支持插入和判断一个数 //线性基 LL p[65],d[65],tot=0; void rebuild(){ for(int i=63;i>=0;i--){ for(int j=i-1;j>=0;j--)
阅读全文
摘要:牛客小白月赛92 题解 A. 获得木头 签到 \((x\times4)/2\times 4 = x \times 8\) #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define p
阅读全文
摘要:Codeforces Round 940 (Div. 2) and CodeCraft-23 题解 题目链接 A. Stickogon 贪心 #include<bits/stdc++.h> using namespace std; #define ff first #define ss second
阅读全文
摘要:A. Bingbong的化学世界 签到 题意: 给你苯环的结构,判断类型。 思路: 按照区别特判即可。 代码: #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb pus
阅读全文
摘要:2024牛客寒假算法基础集训营2 补题 A.Tokitsukaze and Bracelet 签到 模拟 参考代码: #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define eb
阅读全文
摘要:2024牛客寒假算法基础集训营1 补题 A.DFS搜索 模拟 题意: 给你一个字符串 \(S\) ,求出 \(S\) 中是否存在子序列“DFS“和"dfs"。 思路: 直接模拟即可 参考代码: #include<bits/stdc++.h> using namespace std; #define
阅读全文
摘要:Showball 算法整理及模板(2023) jiangly板子 火车头 #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define all(
阅读全文
摘要:Atcoder Beginner Contest 330 题解
阅读全文

浙公网安备 33010602011771号