Asia Hong Kong Regional Contest 2019】的更多相关文章

A. Axis of Symmetry B. Binary Tree n 的奇偶性决定胜负. C. Constructing Ranches 路径上点权之和大于,极大值两倍,这是路径上点能拼出多边形的充要条件. 树分治,进行路径统计即可. 有请 F0_0H 讲解下怎样卡常. D. Defining Labels 签到 E. Erasing Numbers 考虑第 \(i\) 位的答案,因为我们只关心被删掉的元素和 \(a[i]\) 大小关系,把比 \(a[i]\) 小的元素设为 0,比 \(a[…
A. Colourful Graph 可以在$2n$步之内实现交换任意两个点的颜色,然后就可以构造出方案. #include <bits/stdc++.h> using namespace std ; typedef long long LL; const int mod=1e9+7,Maxn=222; const LL Inf=1LL<<60; int n,m,K; int col[Maxn],col2[Maxn]; int done[Maxn],pre[Maxn]; vecto…
题解: https://files.cnblogs.com/files/clrs97/19HKEditorial-V1.zip Code:(Part) A. Axis of Symmetry #include<cstdio> #include<algorithm> #include<vector> using namespace std; typedef long long ll; const int N=100010,inf=1000000010; int Case,…
题目链接 题目大意 要你在[l,r]中找到有多少个数满足\(x\equiv f(x)(mod\; m)\) \(f(x)=\sum_{i=1}^{k-1} \sum_{j=i+1}^{k}d(x,i)*d(x,j)\) \(d(x,i)表示x的第i位数\) 题目思路 显然是数位dp,然而这个数位dp不能同时存x%m 和f(x)%m 这样会内存太大存不了,所以存差值即可 还有这个dfs的时候取模只取一次,不然会t,卡常严重 代码 #include<set> #include<map>…
cf的地址 因为校强, "咕咕十段"队获得了EC-final的参赛资格 因为我弱, "咕咕十段"队现在银面很大 于是咕咕十段决定进行训练. 周末vp了一场, 这是赛后补题. vp的时候想到了可以利用边界和切线, 但是没有仔细思考. 后来发现, 找到可以走的边界和切线之后, bfs一下就完事了啊. 题目给的eps限制使得我们可以合法的沿着切线和边界进行行走 关键在于找出"可以走的边界和切线" 如果一条切线在两个切点之间穿过了一个圆, 那么就不走这条…
A. ABB #include <bits/stdc++.h> using namespace std; #define PB push_back #define ZERO (1e-10) #define INF int(1e9+1) #define CL(A,I) (memset(A,I,sizeof(A))) #define DEB printf("DEB!\n"); #define D(X) cout<<" "<<#X&qu…
A. Radio Prize All boring tree-shaped lands are alike, while all exciting tree-shaped lands are exciting in their own special ways.What makes Treeland more exciting than the other tree-shaped lands are the raddest radio hosts in the local area: Roota…
Classrooms 传送门 The new semester is about to begin, and finding classrooms for orientation activities is always a headache. There are \(k\) classrooms on campus and \(n\) proposed activities that need to be assigned a venue. Every proposed activity ha…
The Problem to Slow Down You Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=141572 Mean: 给你两个字符串,求这两个字符串相同回文串的匹配对数. analyse: 每个字符串建一棵回文树,分别从0结点和1结点两棵树一起往下dfs,对于同一条路径上的结点,一定是相同的回文,然后两个的数量相乘加到answer中. Time complexity: O(N)…
 B Stealing Harry Potter's Precious 题目大意:给定一个n*m的地图,某些点可以走,某些点可以走某些点不可以走,给定一个起点,又给出了k个点k<=4,要求从起点经过K个点最短的长度是多少 思路:给每个点标定状态为[x][y][state],state是压缩状态的已经走过需要走过点的集合,然后bfs一下即可 #include<cstdio> #include<queue> #include<cstring> #define maxn…