- 博客(10)
- 收藏
- 关注
原创 牛客多校第一场 G.Game of Swapping Numbers
题意: 给定两个长度为nnn的数组A,BA,BA,B,你最多能交换kkk次AAA数组中的数,求∑i=1n∣Ai−Bi∣\sum_{i=1}^{n}\lvert A_i-B_i\rvert∑i=1n∣Ai−Bi∣最大是多少 思路:为了方便理解,我们令两者大一点的数为AiA_iAi,小一点的数为BiB_iBi,那么答案∑i=1n∣Ai−Bi∣\sum_{i=1}^{n}\lvert A_i-B_i\rvert∑i=1n∣Ai−Bi∣即可变为∑i=1nAi−Bi\sum_{i=1}^{n} A_i
2021-08-10 22:06:12
177
原创 hduoj 6988 题解
题意: 一个字符串的每个字符都有独特的价值,一个字符串的价值为其所有字符的价值和,子串集为一个字符的所有子串的集合,现在要你求出一个字符串的价值第k小的子串的价值是多少 思路: 前缀知识需要后缀自动机,二分。 后缀自动机的每一个节点可看做一个子串集合,同时可以观察得到在确定好字符后,其后缀的价值具有单调性,因此可以对整体答案进行二分,再对每一个节点二分统计答案即可。 代码: #include<bits/stdc++.h> using namespace std; typedef long lo
2021-08-08 22:17:28
238
原创 The 2020 ICPC Asia Macau Regional Contest C Club Assignment 题解
题意:有n个数,现在要把他们拆分成两个集合,假设S为集合,有如下定义:f(S)={min(x⊗y)∣x,y∈S and x≠y} f(S)=\{min(x\otimes y)|x,y\in S \ and\ x\neq y \} f(S)={min(x⊗y)∣x,y∈S and x=y}将n个数拆分为两个集合A,B,要求最大化min(f(A),f(B) )min(f(A),f(B)\ )min(f(A),f(B) ),并输出划分集合的方案,如果
2021-07-13 23:39:24
1631
2
原创 The 2020 ICPC Asia Macau Regional Contest G题解
原题目: Grammy is playing a game with her roommate Alice on a sequence A with n non-negative integers A1,A2,…,An. The rules of the game are described as follows. They play the game by moving the single token on the sequence, initially the token is at position
2021-07-11 17:53:38
1648
1
原创 AtCoder Beginner Contest 207 F Tree Patrolling题解
题意: 给定一棵树,共有n个节点,你可以放任意数量的保安在树的节点上面,保安能看守他放置的点和该点的直接父节点和直接子节点,问对于能看守0~n个节点的放置方案有多少? 思路: 树上背包优化。设dp方程为:f[0/1/2][i][j]f[0/1/2][i][j]f[0/1/2][i][j]为以1为根节点,没放置在i节点点,且i没被i的子节点看守 / 放置在i节点 / 没放置在i节点上,但i已经被子节点看守,同时在i节点的子树上看守了j个点的方案数,sz[i]sz[i]sz[i]为i节点子树的节点个数,转移方程
2021-07-11 00:03:26
444
1
原创 (AtCoder Regular Contest 122) 题解
A.Many Formulae 题意:给定nnn个数,固定他们,问在两个数中间插入+,−+,-+,−能所有满足要求的表达式(不能不插入+,−+,-+,−)的和为多少,要求是一个数左右两边均为−-− 思路:dp。略 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf=0x3f3f3f3f3f3f3f3f; const int maxn=1e5+10; const int maxk
2021-06-22 00:18:56
428
原创 git相关命令小结
写在前面的话: 写这个的目的主要是学习git命令的使用,在使用git的过程中总会遇到一些问题,每次都需要重新查询资料,因此在这里进行一个小结,也方便自己查阅 如果总结有什么不对的地方,烦请各位帮忙指出 1.初始化git仓库 git init 建立一个.git文件夹,主要作用为记录项目相关的变化 2.添加远程库 git remote add xxx url 添加一个远程仓库,仓库名为xxx,远程仓库地址为url 3.查看远程库版本 git remote -v 查看当前远程库的版本,可以用于验证是否已经添加
2021-05-31 16:50:57
113
原创 Educational Codeforces Round 109 (Rated for Div. 2)题解
C. Robot Collisions 题目: There are n robots driving along an OX axis. There are also two walls: one is at coordinate 0 and one is at coordinate m. The i-th robot starts at an integer coordinate xi (0<xi<m) and moves either left (towards the 0) or righ
2021-05-19 00:52:02
277
1
原创 ACM中的Hash小结
在ACM中Hash的主要用途有: 记忆化搜索中用来压缩状态,从而节省空间 初始化某些数据,方便之后的算法进行处理(搜索,dp等) 用来唯一的标记一个字符串(像大数),用Hash处理后同时能O(1)的得出某个子串的Hash值 具体题目: 待补充… ...
2021-05-13 23:31:54
250
原创 Codeforces Round #720 (Div. 2)题解
C.Nastia and a Hidden Permutation 题目: This is an interactive problem! Nastia has a hidden permutation p of length n consisting of integers from 1 to n. You, for some reason, want to figure out the permutation. To do that, you can give her an integer t (1≤t
2021-05-13 01:15:35
405
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人