考虑到每次与主人相遇之前最多只去一个景点,很容易转化为匹配问题 由于数据很小,我们不妨枚举每个相遇点间隙和每个景点,判断是否来得及,如果来得及就连边 沙雕题搞了二十来分钟,我是憨憨 #include <bits/stdc++.h> using namespace std; #define N 505 int n,m,p,cx[N],cy[N],vis[N],ax[N],ay[N],bx[N],by[N]; std::vector<int> e[N]; int dfs(int u,i…
Cat VS Dog Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others) Problem Description The zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the…
Kingdom of Obsession Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 200 Accepted Submission(s): 64 Problem Description There is a kindom of obsession, so people in this kingdom do things ver…
此题的二分图匹配做法很容易想,就是把属性当做s集,武器当做t集,如果该武器拥有该武器则连一条边. 那么答案就是求该二分图的最大前i个匹配.将匈牙利算法改一改,当前找不到增广路就break. 但是过这个题需要常数优化,不能每次都fillchar一遍used数组.可以用队列将使用的used点加入,然后需要初始化的时候弹出即可. # include <cstdio> # include <cstring> # include <cstdlib> # include <i…