题意:给定一些DNA序列,求一个最短序列能够包含所有序列. 思路:记录第i个序列已经被匹配的长度p[i],以及第i序列的原始长度len[i].则有两个剪枝: 剪枝1:直接取最长待匹配长度.1900ms int h = 0; for(int i = 0; i < n; ++i) { h = max(len[i] - p[i], h); //最大待匹配长度 } 剪枝二:统计每个序列里面四种序列值,并求得每种序列值的最长长度.将四种序列值加起来就是最长待匹配长度.180ms int cal() { /…
ID Origin Title 20 / 60 Problem A HDU 3507 Print Article 13 / 19 Problem B HDU 2829 Lawrence 1 / 5 Problem C HDU 4528 小明系列故事――捉迷藏 5 / 6 Problem D HDU 1300 Pearls 0 / 42 Problem E HDU 2993 MAX Average Problem 1 / 20 Problem F UVALi…
ID Origin Title 17 / 60 Problem A ZOJ 3537 Cake 54 / 105 Problem B LightOJ 1422 Halloween Costumes 59 / 90 Problem C POJ 2955 Brackets 26 / 51 Problem D CodeForces 149D Coloring Brackets 47 / 58 Problem E POJ 1651 Multiplication Puz…
思路:接BFS判断能否在限制时间内到达公主的位置,注意如果骑士进入传送机就会被立即传送到另一层,不会能再向四周移动了,例如第一层的位置(x, y, 1)是传送机,第二层(x, y, 2)也是传送机,这种情况骑士会一直被传上传下. AC代码: 0ms #include<cstdio> #include<cmath> #include<cstring> #include<queue> using namespace std; const int maxn = 1…
保存每个节点的下一个节点一直往下面走就行了,不能重复经过某个点,当经过的点达到20个而且当前节点的下一个节点是起点就打印答案. AC代码 #include<cstdio> #include<vector> #include<cstring> #include<algorithm> using namespace std; const int maxn = 25; int vis[maxn]; vector<int>v[25]; int ans[m…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1560 DNA sequence Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2999 Accepted Submission(s): 1462 Problem Description The twenty-first centu…
ID Origin Title 62 / 175 Problem A CodeForces 55D Beautiful numbers 30 / 84 Problem B HDU 4352 XHXJ's LIS 108 / 195 Problem C HDU 2089 不要62 89 / 222 Problem D HDU 3555 Bomb 59 / 107 Problem E POJ 3252 Round Numbers 47 / 75 Problem…
A-L 二分匹配 M-O 二分图多重匹配 P-Q 二分图最大权匹配 R-S 一般图匹配带花树 模板请自己找 ID Origin Title 61 / 72 Problem A HDU 1045 Fire Net 52 / 112 Problem B HDU 2444 The Accomodation of Students 45 / 86 Problem C HDU 1083 Courses 44 / 63 Problem D HDU 1281 棋盘游戏 35…
ID Origin Title 228 / 440 Problem A HDU 1166 敌兵布阵 207 / 438 Problem B HDU 1754 I Hate It 181 / 727 Problem C POJ 3468 A Simple Problem with Integers 105 / 410 Problem D POJ 2528 Mayor's posters 138 / 230 Problem E HDU 1698 Just a Hook…
并查集的介绍可以看下https://www.cnblogs.com/jkzr/p/10290488.html A - Wireless Network POJ - 2236 An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected afters…
ID Origin Title 111 / 423 Problem A LightOJ 1370 Bi-shoe and Phi-shoe 21 / 74 Problem B LightOJ 1356 Prime Independence 61 / 332 Problem C LightOJ 1341 Aladdin and the Flying Carpet 54 / 82 Problem D LightOJ 1336 Sigma Function 66 /…
ID Origin Title 76 / 163 Problem A POJ 1236 Network of Schools 59 / 177 Problem B UVA 315 Network 49 / 151 Problem C UVA 796 Critical Links 28 / 109 Problem D POJ 3694 Network 39 / 98 Problem E POJ 3177 Redundant Paths 33 / 230 Proble…