题解: 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>…
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…
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[…
$$2017-2018\ ACM-ICPC\ Latin\ American\ Regional\ Programming\ Contest$$ \(A.Arranging\ tiles\) \(B.Buggy\ ICPC\) 分元音位置情况和数量讨论,没有元音答案是1,如果有元音但不在第一个位置上是无法构造出来的,然后其他情况找到最初始的情况的辅音数量即可 //#pragma comment(linker, "/STACK:1024000000,1024000000") #inclu…
2017-2018 ACM-ICPC Southeastern European Regional Programming Contest (SEERC 2017) 全靠 wxh的博客 补完这套.wxhtxdy! [A - Concerts] $f[i][k]$ 表示在第 $i$ 个位置刚好匹配了 $k$ 个字符.转移方程 $$ f[i][k] = \sum_{i - j > h[s[k - 1]]} f[j][k - 1] $$ 前缀和优化加滚动就行了. 好像可以直接用 $f[i][k]$ 表…
layout: post title: 2018-2019 ACM-ICPC Southeastern European Regional Programming Contest (SEERC 2018) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces B.Broken Watch 题解 先不考虑长度 长度不会影响会不会过中心. 如果长度相同 \(C_{n}^{3}\) 再减去不符合的再同一侧的.…
2017-2018 ACM-ICPC Latin American Regional Programming Contest 试题地址:http://codeforces.com/gym/101889 总体情况 总共通过7题CEFGHIJ.其中我完成HIJ三题.纯属被大佬带飞系列. 解题报告 H - Hard choice 签到题 #include <bits/stdc++.h> using namespace std; int a1,b1,c1,a2,b2,c2; int main() {…
2020 ICPC Universidad Nacional de Colombia Programming Contest A. Approach 三分 显然答案可以三分,注意\(eps\)还有两条线平行的情况 view code #include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O2") double dis2(double ox, double oy, double ex, doubl…
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…