图
天夏123
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDOJ-1233 还是畅通工程(最小生成树)
Prime算法:#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <climits> #include <set>using namespace std; #define maxn 105 int Graph[maxn][maxn]; int原创 2016-03-13 11:58:41 · 287 阅读 · 0 评论 -
Codeforces Round #135 (Div. 2)-D. Choosing Capital for Treeland
原题链接 D. Choosing Capital for Treeland time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The co原创 2016-08-30 19:17:45 · 435 阅读 · 0 评论 -
Codeforces Beta Round #22 (Div. 2 Only)-C. System Administrator
原题链接 C. System Administrator time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bob got a job as原创 2016-09-13 18:18:26 · 217 阅读 · 0 评论 -
Codeforces Beta Round #29 (Div. 2, Codeforces format)-D. Ant on the Tree
原题链接 D. Ant on the Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Connected undirected原创 2016-09-16 16:14:01 · 411 阅读 · 0 评论 -
Codeforces Round #362 (Div. 2)-D. Puzzles
原题链接 D. Puzzles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Barney lives in country USC (原创 2016-09-19 18:40:06 · 322 阅读 · 0 评论 -
Educational Codeforces Round 7-E. Ants in Leaves
原题链接 E. Ants in Leaves time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Tree is a connected g原创 2016-10-21 20:30:36 · 288 阅读 · 0 评论 -
Codeforces Round #270-D. Design Tutorial: Inverse the Problem(Prime)
原题链接 D. Design Tutorial: Inverse the Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is原创 2016-10-22 10:49:57 · 213 阅读 · 0 评论 -
Codeforces Round #245 (Div. 2)-C. Xor-tree
原题链接 C. Xor-tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub is very proud of his r原创 2016-10-24 18:45:00 · 601 阅读 · 0 评论 -
Codeforces Round #266 (Div. 2)-E. Information Graph(dfs+并查集)
原题链接 E. Information Graph time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output There are n employees working原创 2016-10-25 12:37:04 · 265 阅读 · 0 评论 -
Codeforces Round #237 (Div. 2)-C. Restore Graph
原题链接 C. Restore Graph time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera had an undirected connecte原创 2016-10-17 16:43:06 · 290 阅读 · 0 评论 -
Codeforces Round #346 (Div. 2)-E. New Reform
原题链接 E. New Reform time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland has n cities connected by m原创 2016-10-28 13:23:22 · 221 阅读 · 0 评论 -
Codeforces Round #285 (Div. 2)-C. Misha and Forest
原题链接 C. Misha and Forest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's define a forest as a non原创 2016-10-18 23:12:17 · 325 阅读 · 0 评论 -
Codeforces Round #288 (Div. 2)-D. Tanya and Password(欧拉路径及其打印)
原题链接 D. Tanya and Password time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While dad was at原创 2017-02-05 12:13:58 · 295 阅读 · 0 评论 -
51nod-1444 破坏道路
原题链接 1444 破坏道路 题目来源: CodeForces 基准时间限制:1.5 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 在某一个国家,那儿有n个城市,他们通过m条双向道路相连。城市从1到n编号。如果城市a和b通过一条道路直接相连,那么他们之间的距离就是一个小时。这个国家的道路网络可以允许你从任意一个城市到达另外原创 2017-01-11 10:39:06 · 508 阅读 · 0 评论 -
Codeforces Round #161 (Div. 2)-D. Cycle in Graph
原题链接 D. Cycle in Graph time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You've got a undirect原创 2017-02-17 16:59:43 · 272 阅读 · 0 评论 -
Codeforces Round #363 (Div. 2) D. Fix a Tree
原题链接 D. Fix a Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A tree is an undirected c原创 2016-07-20 10:46:33 · 330 阅读 · 0 评论 -
POJ--1523 SPF(割点)
原题链接 SPF Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7735 Accepted: 3514 Description Consider the two networks shown below. Assuming that data m原创 2016-07-08 09:16:35 · 316 阅读 · 0 评论 -
HDOJ-2544 最短路(Dijkstra)
单源最短路径问题(感觉和Prime算法很像)#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <climits>using namespace std; #define maxn 105 int Graph[maxn][maxn]; int d原创 2016-03-13 14:24:05 · 259 阅读 · 0 评论 -
HDOJ-1874 畅通工程续(Floyed)
多源最短路径问题#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <climits>using namespace std; #define maxn 205 int Graph[maxn][maxn];int main() { //f原创 2016-03-13 16:29:06 · 293 阅读 · 0 评论 -
POJ2631-Roads in the North(树的最长路径)
随便找一个点u,用DFS求出u的最远结点v,然后再利用一次DFS求出v的最远结点w,则v-w就是最长路径.#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #define maxn 10010 using namespace std; typedef long long ll;struct No原创 2016-05-05 13:59:19 · 450 阅读 · 0 评论 -
Codeforces Round #316 (Div. 2) D. Tree Requests
用深搜为每个结点建立一个时间序in[], out[],在搜索过程中把在同一深度,同一颜色结点的时间保存起来。查询的时候,若结点为v, 则所查询的所有节点的时间序在in[v]和out[v]之间,再用二分查找各个颜色结点个数。#include <bits/stdc++.h> #define maxn 500005 using namespace std;vector<int> v[maxn]; vect原创 2016-05-21 19:05:22 · 370 阅读 · 3 评论 -
Codeforces Round #355 (Div. 2) D. Vanya and Treasure
用vectorv[],v[i]记录所有以i为值得点的坐标,用dis[i][i]记录到达(i, j)的最短距离.有两种方法可以求到终点的最短距离。 1.宽搜+优先队列,队列中刚开始存着以i为值得所有点的坐标,搜出所有以i+1为值得所有坐标和最短距离。 2.当知道所有以i(x2, y2)为值得所有点的距离时,用循环求出以i+1(x1, y1)为值得所有点的距离.dis[x1][y1] = mi原创 2016-06-12 19:30:09 · 352 阅读 · 0 评论 -
Codeforces Round #354 (Div. 2)-Theseus and labyrint
原文链接 题中给的迷宫有四个状态,我把每个状态对应的图都生成。用宽搜求出从原点到每个状态的迷宫的每个格子的最小距离. #include #include #include #include #include #include #include #include #include #define maxn 1005 #define INF 1e9 typedef long原创 2016-06-14 10:06:09 · 348 阅读 · 0 评论 -
Codeforces Round #357 (Div. 2)-D. Gifts by the List
原题链接 我的思路是把 appropriate lists上的数字通过题中给出的家族图确定关系(若a必须在b前面在a->b),再通过拓扑排序输出。 接下里就是建立appropriate lists上数字与数字之间的关系。先建立家族关系图(若a是b的父亲则a->b),并且确定各个点的入度。建立数组p[i], p[i]是i想要送礼物的人。遍历1到n所有的点,若m的入度为零则从m开始深搜,用or原创 2016-06-15 19:01:14 · 565 阅读 · 0 评论 -
匈牙利算法
首先,匈牙利算法是用来求二分图的最大匹配的,它的核心问题就是找增广路径。匈牙利算法的时间复杂度为O(VE),其中 V为二分图左边的顶点数,E为二分图中边的数目。 现在我们来看看增广路有哪些性质: (1)有奇数条边。 (2)起点在二分图的左半边,终点在右半边。 (3)路径上的点一定是一个在左半边,一个在右半边,交替出现。 (4)整条路径上没原创 2016-07-02 13:08:44 · 337 阅读 · 0 评论 -
HDU-2263 过山车(二分图最大匹配)
原题链接 过山车 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 17584 Accepted Submission(s): 7675 Problem Description RPG girls原创 2016-07-02 14:10:04 · 273 阅读 · 0 评论 -
HDU-1054 Strategic Game(二分图最小顶点覆盖)
原题链接 Strategic Game Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7120 Accepted Submission(s): 3377 Problem Description原创 2016-07-02 14:38:15 · 403 阅读 · 0 评论 -
POJ-3041 Asteroids(二分图最小定点覆盖)
原题链接 Asteroids Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19789 Accepted: 10742 Description Bessie wants to navigate her spaceship through a da原创 2016-07-02 16:49:18 · 265 阅读 · 0 评论 -
I’m stuck!
I’m stuck! 给定一个R行C列的地图,地图的每一个方格可能是'#', '+', '-', '|', '.', 'S', 'T'七个字符中的一个,分别表示如下意思: '#': 任何时候玩家都不能移动到此方格; '+': 当玩家到达这一方格后,下一步可以向上下左右四个方向相邻的任意一个非'#'方格移动一格; '-': 当玩家到达这一方格后,下一步可以向左右两个方原创 2016-07-04 23:33:47 · 484 阅读 · 0 评论 -
POJ-1751 Highways
原题链接 Highways Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12583 Accepted: 3623 Special Judge Description The island nation of Flatopia is pe原创 2016-06-19 17:44:22 · 245 阅读 · 0 评论 -
POJ-1144 Network((割顶)
原题链接 Network Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12069 Accepted: 5559 Description A Telephone Line Company (TLC) is establishing a new t原创 2016-07-07 21:27:29 · 283 阅读 · 0 评论 -
51nod-1535 深海探险
原题链接 1535 深海探险 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 关注 很久很久以前的一天,一位美男子来到海边,海上狂风大作。美男子希望在海中找到美人鱼,但是很不幸他只找到了章鱼怪。 然而,在世界的另一端,人们正在积原创 2017-01-19 18:17:40 · 490 阅读 · 0 评论
分享