
状态压缩
文章平均质量分 66
Mr_Treeeee
这个作者很懒,什么都没留下…
展开
-
HDU 3006 The Number of set (状态压缩)
The Number of setTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1472 Accepted Submission(s): 921Problem DescriptionGiven you原创 2017-07-16 11:03:05 · 310 阅读 · 0 评论 -
第六届福建省赛 - G - Simple String Problem (状压DP)
题目题意:给你n长的字符串,是由前k个字母组成的。问你挑出两个子串,他们不能拥有相同的字母。问你len(串a)*len(串b)最大是多少。POINT:状压。考虑串长度只有2000。可以用2000*2000的效率算出每个状态最大的长度是多少。然后如果枚举每个状态再和其他状态相比较得出答案,效率是(1<<k)*(1<<k)。显然是不行的所以预处理出dp[i],代表i这个状态和他...原创 2018-05-09 16:01:40 · 342 阅读 · 2 评论 -
hihoCoder 编程练习赛70 - C拼三角形(状压DP)
https://hihocoder.com/contest/offers70/problem/3 POINT:C(15,3)的效率把可以组合成三角形的3元组都找出来。状压一下。 然后就是一个背包问题了。当状压i&三元组=0的时候就说明这个三元组的三条边都没有被用。 #include <iostream>#include <string.h&...原创 2018-07-29 17:52:25 · 436 阅读 · 0 评论 -
湖南省第十三届大学生计算机程序设计竞赛 - CSU 2005 Nearest Maintenance Point (最短路+bitset)
http://acm.csu.edu.cn/csuoj/problemset/problem?pid=2005 题意:给你一张图,包含点,边,边权值。给定一些点为维修站,问你离每个点最近的维修站是哪【些】点。多个答案按上升排序 POINT:把所有维修站连上一个超级汇点0,然后从0开始跑最短路。用biset状态压缩来存当前点最近的一个维修站。首先把所有维修站都记录一个...原创 2018-07-27 09:32:39 · 335 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第三场) - A PACM Team (01背包+状态压缩输出路径)
https://www.nowcoder.com/acm/contest/141/A 题意:4维的01背包。每个数字都小于等于38。所有开4维的空间是够的。因为物品数量只有38,可以用状态压缩来记录路径。 你也可以开short数组来强行开五维数组。 #include <cstdio>#include <cstring>#includ...原创 2018-07-27 13:26:51 · 278 阅读 · 0 评论 -
2018 Multi-University Training Contest 3 - Problem C. Dynamic Graph Matching (状压DP)
http://acm.hdu.edu.cn/showproblem.php?pid=6321 POINT:其实这题很简单。匹配的点状压就行了。然后DP就是最基本的背包差不多。加一条边,就是加一对匹配的点。u,v。状态包含1<<u和1<<v的dp[x]+=dp[x-1<<u-1<<v]就行了。减的话差不多,就-=。...原创 2018-07-31 22:10:19 · 172 阅读 · 0 评论 -
POJ 2443 - Set Operation (bitset)
http://poj.org/problem?id=2443 题意:给你n个集合(n<=1000),n个集合里有很多数x(1<=x<=10000),可以重复。每次问你a和b,问你能不能在某个集合中既找到a又找到b。 POINT:有两种思路,不过都是状态压缩bitset。1.对每一个数字压缩存在于哪些集合。对两个数字的存在状态&一下,如...原创 2018-07-27 23:09:07 · 273 阅读 · 0 评论 -
2018"百度之星"程序设计大赛 - 资格赛 - 调查问卷 (状态压缩)
http://acm.hdu.edu.cn/showproblem.php?pid=6344 POINT:先n2的效率把每对问卷不同的答案状压压缩完。得到一个1<<m的数组保存了,x这个状态对应的所以答案不同的卷子有几对。 然后枚举答案,x和y 如果x&y>0,代表有贡献。 #include <stdio.h>#inc...原创 2018-08-06 21:00:20 · 322 阅读 · 0 评论 -
ACM-ICPC 2018 南京赛区网络预赛 - E. AC Challenge(状压DP)
https://nanti.jisuanke.com/t/30994 题意:每个作业都有a和b,第i次做这个作业得到的分数为i*a+b。每个作业还可能会有前置作业。问你最大分数是多少。可以不做。POINT:20个作业,可以状压。时间就是这个状态1的个数。 #include <iostream>#include <stdio.h>#inc...原创 2018-09-11 18:45:07 · 189 阅读 · 0 评论 -
Codeforces Beta Round #33 - D. Knights (暴力//建图+lca//bitset状态压缩)
D. Knightstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland is facing dark times again. The army of evil lord Van de Mart is going to conque...原创 2018-03-25 18:45:47 · 516 阅读 · 0 评论 -
HackerRank Hiring Contest - B Winning Lottery Ticket
The SuperBowl Lottery is about to commence, and there are several lottery tickets being sold, and each ticket is identified with a ticket ID. In one of the many winning scenarios in the Superbowl lott原创 2018-01-26 23:30:43 · 880 阅读 · 0 评论 -
POJ 3254 - Corn Fields (状压DP)
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 17014 Accepted: 8987DescriptionFarmer John has purchased a lush new rectangular pasture compo原创 2017-11-21 22:02:52 · 249 阅读 · 0 评论 -
POJ 2777 Count Color (线段树+状态压缩)
Count ColorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 46327 Accepted: 14044DescriptionChosen Problem Solving and Program design as an optional co原创 2017-07-21 15:08:45 · 339 阅读 · 0 评论 -
HDU 1565 方格取数(1) (状压DP)
方格取数(1)Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9419 Accepted Submission(s): 3564Problem Description给你一个n*n的格子的棋盘,每个格原创 2017-08-17 23:06:19 · 319 阅读 · 0 评论 -
HDU 5816 Hearthstone(状态压缩DP+概率)
HearthstoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1119 Accepted Submission(s): 554Problem DescriptionHearthstone is原创 2017-07-17 21:53:19 · 364 阅读 · 0 评论 -
HDU 1074 Doing Homework(状压DP)
Doing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9486 Accepted Submission(s): 4481Problem DescriptionIgnatius ha原创 2017-07-17 15:58:06 · 276 阅读 · 0 评论 -
HDU 3605 Escape(多重匹配||状压缩点的网络流)
EscapeTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 11151 Accepted Submission(s): 2676Problem Description2012 If this is th原创 2017-09-07 22:03:42 · 445 阅读 · 0 评论 -
Codeforces Round #438 - C. Qualification Rounds (状态压缩)
C. Qualification Roundstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSnark and Philip are preparing the原创 2017-10-12 20:32:44 · 331 阅读 · 0 评论 -
HDU 4403 A very hard Aoshu problem (DFS+状压)
A very hard Aoshu problemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1743 Accepted Submission(s): 1200Problem Description原创 2017-11-09 21:10:08 · 282 阅读 · 0 评论 -
POJ - 3139 Balancing the Scale (状态压缩+链表)
Balancing the ScaleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1673 Accepted: 645DescriptionYou are given a strange scale (see the figure below),原创 2017-11-06 12:40:44 · 563 阅读 · 0 评论 -
ZOJ 3755 - Mines (状压DP)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5178题意:大家都玩过扫雷吧。给你n*m的扫雷数字。数字都在偶数列上。也就是说,棋盘是n*(2*m+1)大小。让你输出最少的雷数。 POINT:n最大是10,暗示我们状压DP。挺简单的,不阐述了。#include <stdio.h&...原创 2018-09-27 22:15:58 · 293 阅读 · 0 评论