- 博客(106)
- 收藏
- 关注
原创 九度1035
题目1035:找出直系亲属 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2871 解决:1132 题目描述: 如果A,B是C的父母亲,则A,B是C的parent,C是A,B的child,如果A,B是C的(外)祖父,祖母,则A,B是C的grandparent,C是A,B的grandchild,如果A,B是C的(外)曾祖父,曾
2017-03-17 15:37:29
313
原创 线性表--删除元素
#include #include using namespace std; struct list { int *elem; int len; int listsize; }; int init(struct list &q) { q.elem=(int *)malloc(500*sizeof(int));//线性表所申请的空间
2014-09-11 11:11:17
964
原创 Candies
#include #include #include #include #define oo 1<<28 #include struct node { int u; int v; int w; int next; } edge[1100000]; int n,m; using namespace std; int cnt; int dis[35000]; int
2014-09-01 15:20:11
486
原创 Is the Information Reliable?
#include #include #include #include #define oo 1<<28 #include struct node { int u; int v; int w; int next; } edge[1100000]; int n,m; using namespace std; int cnt; int dis[5000]; int h
2014-09-01 15:17:17
418
原创 Intervals
这个题开始用的简单队列,结果超时了,然后就用了数组来存。而且开始拉掉了一个条件s[i+1]-s[i] 这个题有:0 #include #include #include #include #include #define oo 1<<28 #include struct node { int u; int v; int w; int next; } edg
2014-09-01 15:09:53
457
原创 差分约束小小总结
①:对于差分不等式,a - b <= c ,建一条 b 到 a 的权值为 c 的边,求的是最短路,得到的是最大值 ②:对于不等式 a - b >= c ,建一条 b 到 a 的权值为 c 的边,求的是最长路,得到的是最小值 ③:存在负环的话是无解 ④:求不出最短路(dist[ ]没有得到更新)的话是任意解
2014-08-22 21:35:57
588
原创 Matrix
依然详见注释。。 #include #include #include #include #include #define oo 1<<28 #include #include using namespace std; int pre[210000]; int dis[210000]; int vist[210000]; int head[210000]; int map[10000][10
2014-08-22 21:31:12
332
原创 Kaka's Matrix Travels
这个题要求的是 #include #include #include #include #include #define oo 1<<28 #include #include using namespace std; int pre[210000]; int dis[210000]; int vist[210000]; int head[210000]; int map[10000][100
2014-08-22 21:28:44
449
原创 Minimum Cost
这个题意就是有n,m,k #include #include #include #include #include #define oo 1<<28 #include #include using namespace std; int pre[210000]; int dis[210000]; int vist[210000]; int head[210000]; int a[100000],
2014-08-22 21:26:11
395
原创 Farm Tour
这个题因为还会返回所以需要建 #include #include #include #include #include #define oo 1<<28 #include using namespace std; int pre[2100]; int dis[2100]; int vist[2100]; int head[2100]; struct node { int u;
2014-08-20 19:53:24
645
原创 Going Home
今天仔细听一宁姐的 #include #include #include #include #include #define oo 1<<28 #include using namespace std; int pre[1000]; int dis[1000]; int vist[1000]; int head[1000]; struct node { int u; int
2014-08-20 19:49:37
354
原创 Task Schedule
交了10遍,一直TLE,然后 #include #include #include #include #include #include #define oo 1<<28 using namespace std; int n,m,start,end,cnt; int dep[1100]; int p[1100]; struct node { int u,v,w; int next
2014-08-20 19:40:00
414
原创 PIGS
#include #include #include #include #define oo 1<<28 using namespace std; int n,m,map[300][300]; int a[300],p[300],flow[300][300]; int pig[1000],num[1000],q[1000]; int start,end; void init() { mem
2014-08-20 19:34:16
434
原创 Power Network
#include #include #include #include #define oo 1<<28 using namespace std; int n,m,map[300][300]; int a[300],p[300],flow[300][300]; int start,end; int Dinic() { int u,v; queueq; memset(flow
2014-08-20 19:25:31
346
原创 Flow Problem
#include #include #include #include #define oo 1<<28 using namespace std; int n,m,map[300][300]; int a[300],p[300],flow[300][300]; int start,end; int Dinic() { int u,v; queueq; memset(flow
2014-08-20 19:22:59
361
原创 Drainage Ditches
#include #include #include #include #define oo 1<<28 using namespace std; int n,m,map[300][300]; int a[300],p[300],flow[300][300]; int start,end; int Dinic() { int u,v; queueq; memset(flow
2014-08-20 19:18:00
344
原创 50 years, 50 colors
题意:n行n列, #include #include #include #include using namespace std; int vist[1100]; int map[1100][1100],color[1100],col[1100]; int flag[1100],flag1[1000]; int n,k,m,l; void init() { memset(vist
2014-08-15 15:53:33
432
原创 Air Raid
//先贪心,加入贪心之后未找到未匹配点,则说明已经是最优的,否则则从贪心的基础上DFS进行更新 #include #include #include #include using namespace std; int n,m; int map[1100][1100]; int flag[1100];//y节点标记 int vist[1100];//与Y节点相交的x节点 void init() {
2014-08-15 15:48:01
455
原创 Machine Schedule
题目大意;有两台机器A和B以及N个需要运行的任务。每台机器有M种不同的模式,而每个任务都恰好在一台机器上运行。如果它在机器A上运行,则机器A需要设置为模式xi,如果它在机器B上运行,则机器A需要设置为模式yi。每台机器上的任务可以按照任意顺序执行,但是每台机器每转换一次模式需要重启一次。请合理为每个任务安排一台机器并合理安排顺序,使得机器重启次数尽量少。 //先贪心,加入贪心之后未找到未匹配点,
2014-08-15 15:45:47
422
原创 Girls and Boys
//先贪心,加入贪心之后未找到未匹配点,则说明已经是最优的,否则则从贪心的基础上DFS进行更新 #include #include #include #include using namespace std; int n,m; int map[1100][1100]; int flag[1100];//y节点标记 int vist[1100];//与Y节点相交的x节点 void init() {
2014-08-15 15:36:17
409
原创 过山车
这个题是简单的 //先贪心,加入贪心之后未找到未匹配点,则说明已经是最优的,否则则从贪心的基础上DFS进行更新 #include #include #include #include using namespace std; int n,m; int map[510][510]; int flag[510];//y节点标记 int vist[510];//与Y节点相交的x节点 void i
2014-08-15 15:32:12
750
原创 Surprising Strings
#include #include #include #include #include #include #include using namespace std; map::iterator it; char str[101]; int main() { int n,m,i,j; while(~scanf("%s",str)&&strcmp(str,"*")!=0)
2014-08-09 11:14:16
377
原创 Message Flood
TI #include #include #include #include #include #include using namespace std; map::iterator it; char str[101]; int main() { int n,m,i,j,k; while(~scanf("%d",&n)&&n) { mapq;
2014-08-09 11:07:12
267
原创 Hardwood Species
Description Hardwoods are the botanical group of trees that have broad leaves, produce a fruit or nut, and generally go dormant in the winter. America's temperate climates produce forests with hund
2014-08-09 10:57:08
585
原创 树-堆结构练习——合并果子之哈夫曼树
A - 树-堆结构练习——合并果子之哈夫曼树 Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Submit Status Practice SDUTOJ 2127 Description 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不
2014-08-09 10:40:35
731
原创 数据结构实验之链表三:链表的逆置
数据结构实验之链表三:链表的逆置 Time Limit: 1000MS Memory limit: 65536K 题目描述 输入多个整数,以-1作为结束标志,顺序建立一个带头结点的单链表,之后对该单链表的数据进行逆置,并输出逆置后的单链表数据。 输入 输入多个整数,以-1作为结束标志。 输出 输出逆置后的单链表数据。 示例输入 12
2014-03-13 21:42:29
438
原创 Wormholes
C - Wormholes Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3259 Description W
2014-02-25 21:00:38
489
原创 畅通工程续
B - 畅通工程续 Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1874 Description 某省自从实行了
2014-02-25 20:55:49
538
原创 最短路
A - 最短路 Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2544 Description 在每年的校赛里,所
2014-02-25 20:52:33
555
原创 畅通工程续
畅通工程续Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不
2014-02-21 19:12:05
439
原创 Codeforces Round #231 (Div. 2)---- Counting Sticks
A. Counting Sticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output When new students come to the Specialized Education
2014-02-21 03:04:49
416
原创 数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历
数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历 Time Limit: 1000MS Memory limit: 65536K 题目描述 给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历) 输入 输入第一行为整数n(0 对于每组数据,第一行是三个整数k,m,t(0<k
2014-02-20 16:04:47
465
原创 总结一下模板\(≧▽≦)/
二叉树的各种操作: #include #include #include #include typedef struct node { char data; struct node *lchild,*rchild; }*Tree; void CreateBitree(Tree &p) //建树 { char ch; scanf("%c",&ch); if(
2014-02-20 15:46:06
558
原创 More is better
More is better Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 327680/102400 K (Java/Others) Total Submission(s): 11653 Accepted Submission(s): 4319 Problem Description Mr Wang want
2014-02-20 14:44:17
426
原创 小鑫的城堡
小鑫的城堡 Time Limit: 1000MS Memory limit: 65536K 题目描述 从前有一个国王,他叫小鑫。有一天,他想建一座城堡,于是,设计师给他设计了好多简易图纸,主要是房间的连通的图纸。小鑫希望任意两个房间有且仅有一条路径可以相通。小鑫现在把设计图给你,让你帮忙判断设计图是否符合他的想法。比如下面的例子,第一个是符合条件的,但是,第二个不符合,因为从
2014-02-20 13:10:19
505
原创 Ubiquitous Religions
Ubiquitous Religions Time Limit: 1000MS Memory limit: 65536K 题目描述 There are so many different religions in the world today that it is difficult to keep track of them all. You are interest
2014-02-20 10:37:16
365
原创 电影节
电影节 Time Limit: 1000MS Memory limit: 65536K 题目描述 某届电影节评选电影,共有两部电影进入最后评选环节,有n名观众,每个人有一次投票的机会,每个人都按照规则投给其中一部电影。为了了解情况,记者随机询问了一些人,一共询问了m次,特别神奇的是,记者每次都询问两个人,而且这两个人都把票投给了同一部电影,观众编号为1~n。 输入 多组输
2014-02-20 10:09:37
614
原创 图结构练习——BFS——从起始点到目标点的最短步数
图结构练习——BFS——从起始点到目标点的最短步数 Time Limit: 1000MS Memory limit: 65536K 题目描述 在古老的魔兽传说中,有两个军团,一个叫天灾,一个叫近卫。在他们所在的地域,有n个隘口,编号为1..n,某些隘口之间是有通道连接的。其中近卫军团在1号隘口,天灾军团在n号隘口。某一天,天灾军团的领袖巫妖王决定派兵攻打近卫军团,天灾军
2014-02-19 21:03:35
1455
原创 图结构练习——BFSDFS——判断可达性
图结构练习——BFSDFS——判断可达性 Time Limit: 1000MS Memory limit: 65536K 题目描述 在古老的魔兽传说中,有两个军团,一个叫天灾,一个叫近卫。在他们所在的地域,有n个隘口,编号为1..n,某些隘口之间是有通道连接的。其中近卫军团在1号隘口,天灾军团在n号隘口。某一天,天灾军团的领袖巫妖王决定派兵攻打近卫军团,天灾军团的部队如
2014-02-19 18:28:55
488
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人