随笔分类 -  状态压缩DP

摘要:link class Solution { public: int memo[5][5][7][7][1<<10]; int getMaxGridHappiness(int m, int n, int introvertsCount, int extrovertsCount) { memset(me 阅读全文
posted @ 2020-11-16 09:36 feibilun 阅读(150) 评论(0) 推荐(0)
摘要:link class Solution { public: int n; int memo[50][1<<10]; bool canDistribute(vector<int>& nums, vector<int>& quantity) { vector<int> cnt(1001); n=quan 阅读全文
posted @ 2020-11-16 09:35 feibilun 阅读(136) 评论(0) 推荐(0)
摘要:link class Solution { public: int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; struct Point{ int x; int y; }; int dis[105][105]; int m,n; Point S,T; int mcn 阅读全文
posted @ 2020-04-25 22:25 feibilun 阅读(249) 评论(0) 推荐(0)
摘要:Link #include <bits/stdc++.h> # define LL long using namespace std; const int mod=100000000; int M, N; int grid[12]; LL dp[12][1<<12]; LL dfs(int r, i 阅读全文
posted @ 2020-02-09 21:40 feibilun 阅读(143) 评论(0) 推荐(0)
摘要:Link #include <bits/stdc++.h> # define LL long using namespace std; const int INF=0x7fffffff; int n; double x[16]; double y[16]; double dp[17][1<<16]; 阅读全文
posted @ 2020-02-09 20:42 feibilun 阅读(180) 评论(0) 推荐(0)
摘要:Link Solution 0: class Solution { public: int m,n; int maxStudents(vector<vector<char>>& seats) { m=seats.size(); n=seats[0].size(); vector<vector<int 阅读全文
posted @ 2020-02-09 15:17 feibilun 阅读(275) 评论(0) 推荐(0)
摘要:题目链接 题解: 我们可以对棋盘进行黑白染色,使得任意相邻的两个格子颜色不相同,然后进行二分图最大匹配。 Code: 1 class Solution { 2 public: 3 int N; 4 int M; 5 6 vector<vector<int>> dir{{1,0},{0,1},{-1, 阅读全文
posted @ 2020-02-02 09:41 feibilun 阅读(230) 评论(0) 推荐(0)