hdu-1067(最大独立集)】的更多相关文章

HDU 1067 Gap Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)   Problem Description - 题目描述 Let's play a card game called Gap. You have 28 cards labeled with two-digit numbers. The first digit (from 1 to 4) represent…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1067 queue里面果然不能放vector,还是自己写的struct比较省内存…… #include<bits/stdc++.h> using namespace std; ][]; const int INF=0x3f3f3f3f; ; ; struct Node { ][]; Node(){} Node(][]) { ;i<;i++) ;j<;j++) a[i][j]=x[i][j…
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1123 Accepted Submission(s): 595 Problem Description Let's play a card game called Gap. You have 28 cards labeled with two-digit numbers. The firs…
这题主要有了中间的一些连通块的限制,不太好直接用二分图最大独立集做.考虑到图比较小,可以作补图求最大团来求解. #include <iostream> #include <vector> #include <algorithm> #include <string> #include <string.h> #include <stdio.h> #include <queue> #include <stack> #…
题意:一个动物园里有N只猫和K只狗,一些小朋友来参观,他们如果喜欢狗就不喜欢猫,喜欢猫就不喜欢狗,园长想要移走一些动物,如果,移走的是某个小朋友不喜欢的,而喜欢的没被移走,该小朋友就会高兴,求移动的数目使得最多的小朋友开心 Sample Input 1 1 2 //1个猫1个狗2个小朋友 C1 D1 //一号小朋友喜欢c1,讨厌d1 D1 C1 1 2 4 C1 D1 C1 D1 C1 D2 D2 C1     转换为最大独立集做 #include<cstdio> #include<io…
Gap Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 690    Accepted Submission(s): 380 Problem Description Let's play a card game called Gap.  You have 28 cards labeled with two-digit numbers…
题意:    起初定28张卡牌的排列,把其中11,  21, 31, 41移动到第一列,然后就出现四个空白,每个空白可以用它的前面一个数的下一个数填充,例如43后面的空格可以用44填充,但是47后面即使有空白也无法填充,因为没有48. 思路:每次有四个空格,面临四个选择,直接用bfs搜索,状态保存的话就自己设计一个哈希函数,如果找不到完美哈希一定要解决冲突. 我设计的哈希函数:我用的是双哈希,第一个哈希值用于查找,第二个哈希值可以看做整个卡牌状态的压缩,如果有两种状态有同一个第一哈希,我就用第二…
Girls and Boys Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10500    Accepted Submission(s): 4849 Problem Description the second year of the university somebody started a study on the roman…
KUANGBIN带你飞 全专题整理 https://www.cnblogs.com/slzk/articles/7402292.html 专题一 简单搜索 POJ 1321 棋盘问题    //2019.3.18 POJ 2251 Dungeon Master POJ 3278 Catch That Cow  //4.8 POJ 3279 Fliptile POJ 1426 Find The Multiple  //4.8 POJ 3126 Prime Path POJ 3087 Shuffle…
[kuangbin带你飞]专题1-23 专题一 简单搜索 POJ 1321 棋盘问题POJ 2251 Dungeon MasterPOJ 3278 Catch That CowPOJ 3279 FliptilePOJ 1426 Find The MultiplePOJ 3126 Prime PathPOJ 3087 Shuffle'm UpPOJ 3414 PotsFZU 2150 Fire GameUVA 11624 Fire!POJ 3984 迷宫问题HDU 1241 Oil Deposit…