当前位置:网站首页>uva11825
uva11825
2022-06-29 07:15:00 【Stabbing the bear with a knife】
#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
const int maxn = (1 << 16) + 7;
const int maxm = 20;
int n,m, around[maxm],cover[maxn],f[maxn];
int main()
{
int t,kCase = 1;
while (cin >> n && n) {
for (int i = 0; i < n; i++) {
cin >> m;
// Which computers are around the current location
around[i] = 1 << i;
for (int j = 0; j < m; j++) {
cin >> t;
around[i] |= 1 << t;
}
}
for (int i = 0; i < 1 << n; i++) {
cover[i] = 0;
// Select these locations Which computers can be covered
for (int j = 0; j < n; j++) {
if (i & (1 << j)) cover[i] |= around[j];
}
}
int target = (1 << n) - 1;
f[0] = 0;
for (int i = 1; i < 1 << n; i++) {
f[i] = 0;
for (int j = i; j; j = (j - 1) & i) {
if (cover[j] == target) f[i] = max(f[i], f[i ^ j] + 1);
}
}
cout << "Case " << kCase++ << ": " << f[target] << endl;
}
return 0;
}
边栏推荐
- Illegal forward reference and enums
- Uniapp obtains the date implementation of the beginning and end of the previous month and the next month
- JDBC connects to the database and socket sends the client.
- Summary of some new datasets proposed by cvpr2021
- What is the difference between software engineer and software development? What is the difference between software engineer and software developer?
- Redis in NoSQL database (4): redis publishing and subscription
- CI工具Jenkins安装配置教程
- [translation] [Chapter 2 ③] mindshare PCI Express technology 3.0
- NoSQL数据库之Redis(五):Redis_Jedis_测试
- 施工企业选择智慧工地的有效方法
猜你喜欢

【翻译】e-Cloud。使用KubeEdge的大规模CDN

package. Are you familiar with all configuration items and their usage of JSON

The annual technology inventory of cloud primitives was released, and it was the right time to ride the wind and waves

CI工具Jenkins之二:搭建一个简单的CI项目

. NETCORE uses redis to limit the number of interface accesses

Testing grpc service with grpcui

微信小程序学习笔记(暑假)

idea使用

NoSQL数据库之Redis(一):安装 & 简介

IDEA 集成 码云
随机推荐
Utilisation d'IPv6 pour réaliser l'accès public au bureau distant
Domestic code hosting center code cloud
When the soft keyboard appears, it makes my EditText field lose focus
uva10859
CI工具Jenkins安装配置教程
Instanceklass "suggestions collection" of hotspot class model
关联性——相关性分析
Markdown 技能树(5):图片
Summary of some new datasets proposed by cvpr2021
[translation] [Chapter II ①] mindshare PCI Express technology 3.0
As a qualified network worker, you must master DHCP snooping knowledge!
数字ic设计——UART
JDBC connects to the database and socket sends the client.
package. Are you familiar with all configuration items and their usage of JSON
GenICam GenTL 标准 ver1.5(3)第四章
NoSQL數據庫之Redis(五):Redis_Jedis_測試
2022.6.27-----leetcode. five hundred and twenty-two
[answer all questions] CSDN question and answer function evaluation
What are the conditions for a high-quality public chain?
Introduction to QT qfileinfo