随笔分类 -  算法-模拟

摘要:题目链接 题目 给定第 0 个时刻的 n×m01 矩阵。 每过一个时刻,01 矩阵都会发生如下的变化: 考虑第 x 行第 y 列的格子。若其上下左右四个方向中相邻的格子存在与其数字相同的格子,则此格子在下一个时刻会变成另一个数字(\ 阅读全文
posted @ 2022-05-22 09:46 zhangtingxi 阅读(38) 评论(0) 推荐(0) 编辑
摘要:题目链接 题目 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 阅读全文
posted @ 2022-04-26 18:06 zhangtingxi 阅读(51) 评论(0) 推荐(0) 编辑
摘要:D2T3 教室的电子钟 题目 为了迎接 GDOI,小蒟蒻学校所有教室的钟都换成了电子钟。电子钟会显示年月日时分秒的信息,每天的时间从 00:00:00 到 23:59:59。电子钟共有 14 个格子,共 14 × 7 = 98 个 LED 灯管组成。 具体来说,每个格子都是下面的十种状态中的一种,可 阅读全文
posted @ 2022-04-25 17:49 zhangtingxi 阅读(82) 评论(0) 推荐(0) 编辑
摘要:题目链接 题目 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, 阅读全文
posted @ 2022-01-10 14:22 zhangtingxi 阅读(49) 评论(0) 推荐(0) 编辑
摘要:题目链接 题目 给定两个长度为 n 的只包含'a','b','c'的字符串s,t。 请打乱串 s,使得 i,siti,且 s 字典序最小。 思路 对于 t 串中从前往后每一个字母,在 s 的剩余可选字母中选字典序最 阅读全文
posted @ 2022-01-08 16:16 zhangtingxi 阅读(56) 评论(0) 推荐(0) 编辑
摘要:题目链接 题目 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 阅读全文
posted @ 2021-12-23 18:49 zhangtingxi 阅读(87) 评论(0) 推荐(0) 编辑
摘要:题目链接 题目 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 阅读全文
posted @ 2021-12-20 18:50 zhangtingxi 阅读(77) 评论(0) 推荐(0) 编辑
摘要:题目链接 我要是在noip前做这道题就好了。 这道题的本质就是noip2021方差中的一个性质,对于每个数进行修改,就是把它左右的差进行交换。 注意的是首项一定要一样。 Code // Problem: CF1110E Magic Stones // Contest: Luogu // URL: h 阅读全文
posted @ 2021-12-03 21:06 zhangtingxi 阅读(39) 评论(0) 推荐(0) 编辑
摘要:题目链接 从1开始从小到大考虑,用set维护每个数左右的扩散范围,然后答案为这个数的区间就是左端点个数 × 右端点个数。 Code // Problem: AT2060 [AGC005B] Minimum Sum // Contest: Luogu // URL: https:// 阅读全文
posted @ 2021-12-02 14:49 zhangtingxi 阅读(71) 评论(0) 推荐(0) 编辑
摘要:题目链接 可以发现,我们并不需要对所有节点进行枚举,我们只需要对所有端点甚至只需要枚举右端点即可。 因为如果这个不是端点,那么在它右边的点和它所在的区间个数相同,同时右边的点必然大于这个点,所以不用考虑这个点。 按照线段覆盖问题求出每个点的覆盖情况即可,也可以说是一维扫描线(雾 时间复杂度:\(O( 阅读全文
posted @ 2021-11-18 22:34 zhangtingxi 阅读(43) 评论(0) 推荐(0) 编辑
摘要:题目链接 纯模拟题,无任何算法或思维难度。 难度虚高了。 对于时间和空间分别排个序,然后依次进行就行了。 看一下是先遇到减速地点还是减速时间。 要注意精度问题。 时间复杂度:O(n)。 Code // Problem: P2338 [USACO14JAN]Bessie Slows Down 阅读全文
posted @ 2021-11-17 21:52 zhangtingxi 阅读(118) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示