A 签到. C 源点向每个软件连边.把每个软件拆成对应版本数个点,每个软件向版本连边.把每个conflict也看成一个点.每个版本向它对应的conflict连边,conflict向汇点连边.没有在conflict里的版本直接向汇点连边.所有边的容量都是$1$,跑最大流即可.conflict的意思也就是这些点最多只能选一个,那么拆点并限制容量即可. D 把每个点跟它有限制的点加入一个set,加边时用并查集维护,然后启发式合并两个set就行了. E 签到. H 这一看到一定是二分啊.然后T了一整场.…
A. Base $i - 1$ Notation 两个性质: $2=1100$ $122=0$ 利用这两条性质实现高精度加法即可. 时间复杂度$O(n)$. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<…
1. GUI 按题意判断即可. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<queue> #include&l…
A. City Wall 找规律. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<queue> #include…
A. Ability Draft 记忆化搜索. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<queue> #i…
A. Donut 扫描线+线段树. #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; const int N=800010,M=2222222; int n,m,cnt,i,j;ll L,R,D,a[N]; int tag[M],v[M],ans; struct E{ ll x,l,r;int s; E(){} E(ll _x,ll _l,ll _r,int _s){x=_…
A. Three Arrays 枚举每个$a_i$,双指针出$b$和$c$的范围,对于$b$中每个预先双指针出$c$的范围,那么对于每个$b$,在对应$c$的区间加$1$,在$a$处区间求和即可. 树状数组维护,时间复杂度$O(n\log n)$. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include&…
A. Pieces of Parentheses 将括号串排序,先处理会使左括号数增加的串,这里面先处理减少的值少的串:再处理会使左括号数减少的串,这里面先处理差值较大的串.确定顺序之后就可以DP了. 时间复杂度$O(n^3)$. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N=310,inf=1000000; int n,i,j,m,all,…
题目: Problem D. Great AgainInput file: standard inputOutput file: standard outputTime limit: 2 secondsMemory limit: 512 megabytesThe election in Berland is coming. The party United Berland is going to use its influence to win themagain. The crucial co…
题目:Problem K. PiecemakingInput file: standard inputOutput file: standard outputTime limit: 1 secondMemory limit: 512 mebibytesThe civil war in Berland continues for five years already. The United Nation decided to end the bloodshed.Berland consists o…