Stay Hungry,Stay Foolish!

上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 32 下一页
摘要: P1983 [NOIP2013 普及组] 车站分级 https://www.luogu.com.cn/problem/P1983 思路 https://www.cnblogs.com/tomori/p/14331510.html Code https://www.luogu.com.cn/recor 阅读全文
posted @ 2023-03-03 12:40 lightsong 阅读(46) 评论(0) 推荐(0)
摘要: C. Fox And Names https://codeforces.com/problemset/problem/510/C 思路 使用拓扑序算法,找出前后的依赖的可能情况。 如果拓扑序未找到所有的节点,表明存在依赖环,这种情况不满足。 Code https://codeforces.com/p 阅读全文
posted @ 2023-03-01 10:25 lightsong 阅读(35) 评论(0) 推荐(0)
摘要: E - Make it Palindrome https://atcoder.jp/contests/abc290/tasks/abc290_e 思路 参考: https://zhuanlan.zhihu.com/p/608325900 双指针部分,添加解释: Code https://zhuanl 阅读全文
posted @ 2023-03-01 00:03 lightsong 阅读(62) 评论(0) 推荐(0)
摘要: E - Find Permutation https://atcoder.jp/contests/abc291/tasks/abc291_e 思路 对于能唯一确定的情况,必然存在一个升序 路径 AX1 < AX2 < .... < AXn *** 如果有两个及以上入度为0的起点, 则这两点的先后关系 阅读全文
posted @ 2023-02-27 22:04 lightsong 阅读(47) 评论(0) 推荐(0)
摘要: G - Longest Path https://atcoder.jp/contests/dp/tasks/dp_g 思路 使用拓扑序, 依此从入度为0的节点开始, 向外扩展,直至只剩一个节点 扩展的过程中,对每个点的最大路径做记录。 Code https://atcoder.jp/contests 阅读全文
posted @ 2023-02-27 21:53 lightsong 阅读(42) 评论(0) 推荐(0)
摘要: D - Flip Cards https://atcoder.jp/contests/abc291/tasks/abc291_d 思路 动态规划思想 初始设置, 表示第一个位置, a 和 b各有一种选择 an[1] = 1 bn[1] = 1 后面使用递推式: an[i] += an[i-1] if 阅读全文
posted @ 2023-02-26 22:54 lightsong 阅读(102) 评论(0) 推荐(0)
摘要: D - Marking https://atcoder.jp/contests/abc290/tasks/abc290_d 思路 https://zhuanlan.zhihu.com/p/607818729 x即为最小循环节的长度 即经过x次mark, mark的位置又回到了 0 位置。 如下为x最 阅读全文
posted @ 2023-02-26 17:49 lightsong 阅读(55) 评论(0) 推荐(1)
摘要: D. Mouse Hunt https://codeforces.com/problemset/problem/1027/D 思路 考察ssc检测算法 每个宿舍对应下图中一个点, 由于老鼠从每个宿舍出发,只能到达一个宿舍, 则有向图中存在的 强连通子图 只可能是环,如下图 在检测出的强连通子图中, 阅读全文
posted @ 2023-02-21 21:20 lightsong 阅读(23) 评论(0) 推荐(0)
摘要: Popular Cows http://poj.org/problem?id=2186 思路 涉及到有向图的强连通子图检测,参考: https://oi-wiki.org/graph/scc/ https://www.cnblogs.com/zwfymqz/p/6693881.html 检测出每个强 阅读全文
posted @ 2023-02-20 22:47 lightsong 阅读(35) 评论(0) 推荐(0)
摘要: E - Swap Places https://atcoder.jp/contests/abc289/tasks/abc289_e 思路 T 从 1 要到 4 A 从 4 要到 1 两人同步移动 每次移动到的目标节点,花色要求不同。 设置系统i时刻所处的位置为 <Ti, Ai> 系统agent是在一 阅读全文
posted @ 2023-02-17 23:10 lightsong 阅读(75) 评论(0) 推荐(0)
摘要: E - Dividing Chocolate https://atcoder.jp/contests/abc159/tasks/abc159_e 思路 对于不大于k位置的查找, 前一篇给出了基于前缀和的 从左向右逐步查找方法 https://www.cnblogs.com/lightsong/p/1 阅读全文
posted @ 2023-02-16 21:47 lightsong 阅读(49) 评论(0) 推荐(0)
摘要: E - Dividing Chocolate https://atcoder.jp/contests/abc159/tasks/abc159_e 思路 https://www.cnblogs.com/ycx-akioi/p/AtCoder-abc159.html 行数少,列数多, 对行应用组合方法, 阅读全文
posted @ 2023-02-15 21:48 lightsong 阅读(33) 评论(0) 推荐(0)
摘要: D - Step Up Robot https://atcoder.jp/contests/abc289/tasks/abc289_d 思路 - 1 DFS 从0开始, 否则运用所有可能步子,检查新的位置点, 遇到block返回false, 是目标点x返回true Code - 1 DFS http 阅读全文
posted @ 2023-02-11 22:32 lightsong 阅读(49) 评论(0) 推荐(0)
摘要: C - Coverage https://atcoder.jp/contests/abc289/tasks/abc289_c 思路 对所有组合,依此遍历 判断组合内所有的集合是否覆盖 1...n 判断过程中,如果发现某个数不能被覆盖,则说明此组合不满足要求, 如果满足要求,计数加1 Code htt 阅读全文
posted @ 2023-02-11 22:23 lightsong 阅读(70) 评论(0) 推荐(0)
摘要: P1015 [NOIP1999 普及组] 回文数 https://www.luogu.com.cn/problem/P1015 思路 将字符串m转换为10进制的值 翻转m,也转换为10进制值, 后运用10进制加这两个数 转换为对应进制n的字符串, 判断是否为回文 Code -- Partial AC 阅读全文
posted @ 2023-02-11 15:54 lightsong 阅读(149) 评论(0) 推荐(0)
摘要: A. One and Two https://codeforces.com/problemset/problem/1788/A 思路 统计2的个数, 如果是奇数个, 不满足 如果是偶数个, 2队列中,前半部分最后一个2则为目标位置 如果个数是0, 即都是1的情况, 则k=1 Code https:/ 阅读全文
posted @ 2023-02-11 11:04 lightsong 阅读(33) 评论(0) 推荐(0)
摘要: B. Sum of Two Numbers https://codeforces.com/problemset/problem/1788/B 思路 计算原数的所有位置上的digit和 得到digit和的一半 对于原数从左到右切分,前半部分digit和为half 例如: 1331 -->> 1300 阅读全文
posted @ 2023-02-11 11:00 lightsong 阅读(39) 评论(0) 推荐(0)
摘要: P1002 [NOIP2002 普及组] 过河卒 https://www.luogu.com.cn/problem/P1002 思路 初始设置 0 行 0列的点 取值为1,表示有一条路径到达此目标点, 注意当遇到第一个障碍点, 停止赋值 然后对 1-n 行 1-m列 做dp计算 按照如下公式: dp 阅读全文
posted @ 2023-02-10 18:21 lightsong 阅读(55) 评论(0) 推荐(0)
摘要: B. Solitaire https://codeforces.com/problemset/problem/208/B 思路 dfs+回溯 对两种操作情况进行 地毯式搜索, 找到可能的一种方法。 Note: 需要使用cache对已经搜索过的路径的结果,做记录, 减少重复计算。参考: https:/ 阅读全文
posted @ 2023-02-10 00:04 lightsong 阅读(33) 评论(0) 推荐(0)
摘要: D - Pair of Balls https://atcoder.jp/contests/abc216/tasks/abc216_d 思路 m个桶, n个颜色, 第一轮遍历所有桶的最上面球的颜色, 将相同颜色的球所在队列, 计入 color节点, 即是说,存在两个桶的最上面的两个球颜色相同, 例如 阅读全文
posted @ 2023-02-08 22:25 lightsong 阅读(44) 评论(0) 推荐(0)
摘要: D - Restricted Permutation https://atcoder.jp/contests/abc223/tasks/abc223_d 思路 https://zhuanlan.zhihu.com/p/135094687 利用拓扑排序方法, 先找入度为0的点,建立优先队列,包括: 2 阅读全文
posted @ 2023-02-06 23:03 lightsong 阅读(38) 评论(0) 推荐(0)
摘要: C - Don’t be cycle https://atcoder.jp/contests/abc288/tasks/abc288_c 思路 检测出最小环有几个, 然后破掉相同数目的边即可。 检测最小环数目方法: Code https://atcoder.jp/contests/abc288/su 阅读全文
posted @ 2023-02-05 00:56 lightsong 阅读(67) 评论(0) 推荐(0)
摘要: E - Yutori https://atcoder.jp/contests/abc161/tasks/abc161_e 思路 https://blog.csdn.net/weixin_45750972/article/details/105325285 两种贪心策略: 从左边尽早完成任务; 从右边 阅读全文
posted @ 2023-02-04 19:06 lightsong 阅读(30) 评论(0) 推荐(0)
摘要: D - Match or Not https://atcoder.jp/contests/abc287/tasks/abc287_d 思路 https://www.acwing.com/solution/content/166180/ 对于t,分成两个段, 前段在s和t的最大前缀找, 后端在s和t的 阅读全文
posted @ 2023-02-04 11:56 lightsong 阅读(23) 评论(0) 推荐(0)
摘要: D - Takahashi Tour https://atcoder.jp/contests/abc213/tasks/abc213_d 思路 图数据结构存储边的关系。 DFS遍历, 对于相邻节点存储使用set。 Code https://atcoder.jp/contests/abc213/sub 阅读全文
posted @ 2023-02-03 21:51 lightsong 阅读(45) 评论(0) 推荐(0)
摘要: C - Path Graph https://atcoder.jp/contests/abc287/tasks/abc287_c 思路 判断所有点组成一个链的路径 根据每个节点的度来判断: 链路的度: 两边为节点度为1, 中间所有节点度为2. 1 -- 2 -- 2 -- ... -- 2 -- 1 阅读全文
posted @ 2023-01-29 23:28 lightsong 阅读(55) 评论(0) 推荐(0)
摘要: E - Bishop 2 https://atcoder.jp/contests/abc246/tasks/abc246_e 思想 BFS遍历。 Code https://atcoder.jp/contests/abc246/submissions/38443616 bool pts[1505][1 阅读全文
posted @ 2023-01-29 23:20 lightsong 阅读(31) 评论(0) 推荐(0)
摘要: Deploying from a Git Tag -- buildingTag https://notesfromthelifeboat.com/post/deploying-from-a-git-tag/ If you want to evaluate your changes in the st 阅读全文
posted @ 2023-01-24 23:11 lightsong 阅读(35) 评论(0) 推荐(0)
摘要: B - New Place https://atcoder.jp/contests/arc154/tasks/arc154_b 思路 https://blog.csdn.net/nike0good/article/details/128751025 由于操作的特殊性,从s的第一个字符删除,插入后面任 阅读全文
posted @ 2023-01-23 20:17 lightsong 阅读(51) 评论(0) 推荐(0)
摘要: A - Swap Digit https://atcoder.jp/contests/arc154/tasks/arc154_a 思路 A 和 B中数字需要互换, 互换的准则是,使得 互换后的 AB 乘积最小, 互换后的 A 和 B 差值尽量大 即: 将对应位置的 数字, 小的数字放在A, 大的数字 阅读全文
posted @ 2023-01-23 18:28 lightsong 阅读(69) 评论(0) 推荐(0)
摘要: E - Souvenir https://atcoder.jp/contests/abc286/tasks/abc286_e 思想 图计算Floyd算法,求任意两点之间的最短距离 最短距离对应路径上value总和。 Floyd算法理解 https://www.cnblogs.com/lightson 阅读全文
posted @ 2023-01-22 23:54 lightsong 阅读(38) 评论(0) 推荐(0)
摘要: D - Money in Hand https://atcoder.jp/contests/abc286/tasks/abc286_d 思路 参考:https://www.geeksforgeeks.org/coin-change-dp-7/ dp[i][j]: for j yuan, find i 阅读全文
posted @ 2023-01-22 22:30 lightsong 阅读(25) 评论(0) 推荐(0)
摘要: D - Money in Hand https://atcoder.jp/contests/abc286/tasks/abc286_d 思路 -- 可达性标记法 创建可达性标记map vis 默认设置 vis[0] = true 表示 0 的钱数,可以凑成,不用选取任何硬币 对于 A1 B1 做可访 阅读全文
posted @ 2023-01-22 14:00 lightsong 阅读(61) 评论(0) 推荐(0)
摘要: C - Rotate and Palindrome https://atcoder.jp/contests/abc286/tasks/abc286_c 思路 从原始字符串开始, rotate第一次, rotate第二次, ... , rotate最后一次 对于每种情况得到的字符串: 判断如果转换成回 阅读全文
posted @ 2023-01-22 13:38 lightsong 阅读(69) 评论(0) 推荐(0)
摘要: C - abc285_brutmhyhiizp https://atcoder.jp/contests/abc285/tasks/abc285_c 思路 对于长度为L+1的字符序列, A[1], ..., A[L], A[L+1] 首先统计长度为1 到 L 字符序列 总数, 即 A , ... , 阅读全文
posted @ 2023-01-20 13:06 lightsong 阅读(33) 评论(0) 推荐(0)
摘要: D - Change Usernames https://atcoder.jp/contests/abc285/tasks/abc285_d 思路 DFS深度遍历图。 需要注意的是, 整个大图中可能有很多小的连通子图, 每个子图需要确定起始访问节点,起始节点为没有入度的节点。 同时还需要注意的是, 阅读全文
posted @ 2023-01-20 12:59 lightsong 阅读(66) 评论(0) 推荐(0)
摘要: 1032. Find a Multiple https://acm.timus.ru/problem.aspx?space=1&num=1032 思路 对于n个数 a[1] ... a[n] 首先计算累加和 s[1] ... s[n] s[i] = a[1] + a[2] + ... + a[i] 阅读全文
posted @ 2023-01-10 22:35 lightsong 阅读(31) 评论(0) 推荐(0)
摘要: B. Kolya and Tandem Repeat https://codeforces.com/problemset/problem/443/B 思路 如果补充字符长度k大于等于s长度,则新的字符串,一份两半, 前半分包括s,可能包括部分补充的字符, 后半部分,则是完全的补充字符,可以完全匹配前 阅读全文
posted @ 2023-01-08 23:22 lightsong 阅读(49) 评论(0) 推荐(0)
摘要: C - Count Connected Components https://atcoder.jp/contests/abc284/tasks/abc284_c 思路 寻找独立的子连通图个数。 使用map记录边,即点之间的连通性 使用vector记录顶点是否被访问过 使用queue对任意未访问点做b 阅读全文
posted @ 2023-01-08 18:01 lightsong 阅读(63) 评论(0) 推荐(0)
摘要: E - Don't Isolate Elements https://atcoder.jp/contests/abc283/tasks/abc283_e 思路 参考 https://www.cnblogs.com/cilinmengye/p/17008799.html 阅读全文
posted @ 2023-01-07 19:55 lightsong 阅读(54) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 32 下一页
千山鸟飞绝,万径人踪灭