上一页 1 ··· 81 82 83 84 85 86 87 88 89 ··· 127 下一页

2019年12月17日

摘要: 地址 https://www.acwing.com/problem/content/description/853/ 给定一个n个点m条边的有向图,图中可能存在重边和自环, 边权可能为负数。 请你求出1号点到n号点的最短距离,如果无法从1号点走到n号点,则输出impossible。 数据保证不存在负 阅读全文
posted @ 2019-12-17 14:38 itdef 阅读(269) 评论(0) 推荐(0)
摘要: 地址 https://www.acwing.com/problem/content/description/855/ 给定一个n个点m条边的有向图,图中可能存在重边和自环, 边权可能为负数。 请你求出从1号点到n号点的最多经过k条边的最短距离,如果无法从1号点走到n号点,输出impossible。 阅读全文
posted @ 2019-12-17 11:56 itdef 阅读(256) 评论(0) 推荐(0)

2019年12月16日

摘要: 地址 https://www.acwing.com/problem/content/description/852/ 这里相比上一篇 Dijkstra模板 使用了堆记录点距离 从而节省了查找最短距离的开销 阅读全文
posted @ 2019-12-16 18:35 itdef 阅读(403) 评论(0) 推荐(0)
摘要: 地址 https://www.acwing.com/problem/content/description/851/ 给定一个n个点m条边的有向图,图中可能存在重边和自环,所有边权均为正值。 请你求出1号点到n号点的最短距离,如果无法从1号点走到n号点,则输出-1。 输入格式 第一行包含整数n和m。 阅读全文
posted @ 2019-12-16 16:59 itdef 阅读(435) 评论(0) 推荐(0)

2019年12月15日

摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/minimum-falling-path-sum-ii/ 题目描述给你一个整数方阵 arr ,定义「非零偏移下降路径」为:从 arr 数组中的每一行选择一个数字,且按顺序选 阅读全文
posted @ 2019-12-15 00:24 itdef 阅读(308) 评论(0) 推荐(0)
摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/remove-covered-intervals/ 目描述给你一个区间列表,请你删除列表中被其他区间所覆盖的区间。 只有当 c <= a 且 b <= d 时,我们才认为区 阅读全文
posted @ 2019-12-15 00:23 itdef 阅读(422) 评论(0) 推荐(0)
摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/element-appearing-more-than-25-in-sorted-array/ 目描述给你一个非递减的 有序 整数数组,已知这个数组中恰好有一个整数,它的出 阅读全文
posted @ 2019-12-15 00:21 itdef 阅读(300) 评论(0) 推荐(1)
摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/iterator-for-combination/ 题目描述请你设计一个迭代器类,包括以下内容: 一个构造函数,输入参数包括:一个 有序且字符唯一 的字符串 charact 阅读全文
posted @ 2019-12-15 00:19 itdef 阅读(417) 评论(0) 推荐(0)

2019年12月12日

摘要: 地址 http://poj.org/problem?id=3468 线段树模板 要背下此模板 1 #include <iostream> 2 #include <vector> 3 #include <math.h> 4 #include <algorithm> 5 6 7 using namesp 阅读全文
posted @ 2019-12-12 17:10 itdef 阅读(406) 评论(0) 推荐(0)
摘要: 地址 http://poj.org/problem?id=2456 解法 使用二分逐个尝试间隔距离 能否满足要求 检验是否满足要求的函数 使用的思想是贪心 第一个点放一头牛 后面大于等于尝试的距离才放置一头牛 如果能放置完所有的牛 那么就继续增加尝试的距离 否则就减少尝试的距离 代码 1 #incl 阅读全文
posted @ 2019-12-12 14:23 itdef 阅读(324) 评论(0) 推荐(0)
上一页 1 ··· 81 82 83 84 85 86 87 88 89 ··· 127 下一页

导航