随笔分类 - 算法-模拟
摘要:题目链接 题目 给定第 个时刻的 的 矩阵。 每过一个时刻, 矩阵都会发生如下的变化: 考虑第 行第 列的格子。若其上下左右四个方向中相邻的格子存在与其数字相同的格子,则此格子在下一个时刻会变成另一个数字(\
阅读全文
摘要:题目链接 题目 Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting o
阅读全文
摘要:D2T3 教室的电子钟 题目 为了迎接 GDOI,小蒟蒻学校所有教室的钟都换成了电子钟。电子钟会显示年月日时分秒的信息,每天的时间从 00:00:00 到 23:59:59。电子钟共有 14 个格子,共 14 × 7 = 98 个 LED 灯管组成。 具体来说,每个格子都是下面的十种状态中的一种,可
阅读全文
摘要:题目链接 题目 Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n n n hills,
阅读全文
摘要:题目链接 题目 Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3 × 3 g
阅读全文
摘要:题目链接 题目 The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is
阅读全文
摘要:题目链接 我要是在noip前做这道题就好了。 这道题的本质就是noip2021方差中的一个性质,对于每个数进行修改,就是把它左右的差进行交换。 注意的是首项一定要一样。 Code // Problem: CF1110E Magic Stones // Contest: Luogu // URL: h
阅读全文
摘要:题目链接 从1开始从小到大考虑,用set维护每个数左右的扩散范围,然后答案为这个数的区间就是左端点个数 右端点个数。 Code // Problem: AT2060 [AGC005B] Minimum Sum // Contest: Luogu // URL: https://
阅读全文
摘要:题目链接 可以发现,我们并不需要对所有节点进行枚举,我们只需要对所有端点甚至只需要枚举右端点即可。 因为如果这个不是端点,那么在它右边的点和它所在的区间个数相同,同时右边的点必然大于这个点,所以不用考虑这个点。 按照线段覆盖问题求出每个点的覆盖情况即可,也可以说是一维扫描线(雾 时间复杂度:\(O(
阅读全文
摘要:题目链接 纯模拟题,无任何算法或思维难度。 难度虚高了。 对于时间和空间分别排个序,然后依次进行就行了。 看一下是先遇到减速地点还是减速时间。 要注意精度问题。 时间复杂度:。 Code // Problem: P2338 [USACO14JAN]Bessie Slows Down
阅读全文