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

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,…
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[…
题目链接 题目大意 要你在[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>…
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…
Problem D Lost in Translation The word is out that you’ve just finished writing a book entitled How to Ensure Victory at a Programming Contest and requests are flying in. Not surprisingly, many of these requests are from foreign countries, and while…
传送门: Vjudge:https://vjudge.net/problem/Gym-101170F CF: http://codeforces.com/gym/101170 The city of Bath is a noted olympic training ground—bringing local, national, and even international teams to practice. However, even the finest gymnasium falls v…
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…
A-Evolution Game 题目大意:有$n$个不同的野兽,定义第$i$ 个野兽有 $i$ 个眼睛和 $h[i]$ 个角,你可以任意从中选择一个野兽进行进化,每次进化角数量必须增加,而且进化后要满足眼镜的变化量 $\triangle i \leq w$,求最多的进化次数. 题解:以$h$的值从大到小排序,$f[i]$表示从第i个野兽开始进化的最多次数.对于$1 \leq i \leq j$若满足条件则$f[j]=max \{  f[i]+1 \}$. #include<iostream>…