06 2021 档案
摘要:出现次数最多的数字的次数即为最少的答案, 只需要依次将序列按顺序分隔开即可,每组 \(n/ans\) 的长度 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 10010; int
阅读全文
摘要:注意到行列互不影响,所以将行列分开考虑 问题转化为:给定 \(n\) 条线段,填入 \(n\) 个格子,使得每个线段都被填入一个格子,且同一个格子只能填入一个线段 贪心,一个一个格子来看,所以将所有线段按左端点排序,该格子可以填入左端点在该格子左边的所有线段,为了保证最优, 再将这些线段按右端点排序
阅读全文
摘要:二分没什么好说的,但 \(check\) 函数很难写 首先将所有任务按左端点排序,然后枚举时间,速度就是单位时间的工作量 在当前时间之前开始的所有任务中,贪心地先完成结束时间早的任务,使用优先队列来实现 (枚举任务查看时间的写法要处理浮点数,没有通过,不知道是哪里有问题) AC代码: #includ
阅读全文
摘要:利用几何关系转化以后,变成经典的区间覆盖问题,每次选择当前覆盖范围内能覆盖最远的线段 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 10010; const double eps
阅读全文
摘要:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=1736&mosmsg=Submission+received+with+ID+2645038
阅读全文
摘要:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4098 首先打表,正方体旋转的 \(24\) 种姿态 枚举所有正方体的旋转状态(第 \(1\) 个正方体不用旋转)
阅读全文
摘要:先枚举出第一行的 \(2^n\) 种状态,然后递推出后面所有的行 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 20; const int INF = 1000000007; i
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; const string ma[500] = { "1w","2w","3w","4w","5w","6w","7w","8w","9w", "1b","2b","3b","4b","5b","6b"
阅读全文

浙公网安备 33010602011771号