powers super 11752 the
The 2023 ICPC Asia Hong Kong Regional Programming Contest (The 1st Universal Cup, Stage 2:Hong Kong)
题解: https://files.cnblogs.com/files/clrs97/2022Hong_Kong_Tutorial.pdf Code: A. TreeScript #include <bits/stdc++.h> using namespace std; using LL = lon ......
The 2022 ICPC Asia Hangzhou Regional Programming Contest
题解: https://files.cnblogs.com/files/clrs97/2022ICPCHangzhouTutorial.pdf Code: A. Modulo Ruins the Legend #include<bits/stdc++.h> using namespace std; ......
Madoka and The Best University (cf E)( 枚举一个其中一个元素,欧拉函数,gcd)
#include<iostream> #include<cstring> using namespace std; const int Maxn=1e7; int phi[Maxn];//记录数的约数个数(欧拉函数) bool vis[Maxn];//记录数字是否访问 int prime[Maxn] ......
Madoka and The Corruption Scheme (CF D)(二叉树 整体考虑)
思路 : 题意 性质 : 要让某个人赢, 从上往下 右走了几次到他, 因此 就是 从 n轮中 选择 k 次往右走的 所有情况 ans 就是 tot- C(n,i) i>k 的选择次数, 把大的数往里面赛就行了. ......
[题解]P3656 [USACO17FEB] Why Did the Cow Cross the Road I P
思路 首先,\(A\) 和 \(B\) 只会移动一个,那么,我们分开来算,我们先假定 \(B\) 会动。 不妨令 \(A\) 与 \(b\) 连边的端点为 \(x,y\)。如果有线段 \(pq\) 能与 \(xy\) 相交,一定满足如下其中一条规律: \(p < x \wedge q > y\) \ ......
The 2021 ICPC 南京 ACJM
The 2021 ICPC Asia Nanjing Regional Contest (XXII Open Cup, Grand Prix of Nanjing) A.Oops, It’s Yesterday Twice More 思路:考虑先把所有袋鼠集中在一起然后再移动。因为有步数限制(\(\ ......
The 2022 ICPC 南京 ADG
The 2022 ICPC Asia Nanjing Regional Contest A.Stop, Yesterday Please No More 思路:因为袋鼠是同时移动的,所以我们可以不考虑袋鼠怎么动,而去考虑边界怎么动。所以我们先不考虑洞的影响,先确定哪些会因为边界而离开。确定好最终边界 ......
洛谷 Power Tree 题解
题目链接 Power Tree 分析 将叶子节点按dfs序重标号后,每次控制操作可以转化为将子树内叶子节点所在区间加(或减)一个数 不难可以想到将叶子区间进行差分 每次对 \(l\) 到 \(r\) 的操作可以转化为将 \(l\) 上的数转移到 \(r+1\) 上 每次操作后差分数组的和不变 将所有 ......
[题解] CF632F - Swimmers in the Pool
CF632F - Swimmers in the Pool 题目传送门 题意 给定一个大小为 \(n \times n\) 的矩阵 \(A\) 。假设 \(A\) 满足以下条件,那么称该矩阵为 MAGIC ,否则为 NOT MAGIC ,并输出对应的属性(即 \(A\) 是 MAGIC 还是 NOT ......
E. Power of Points
E. Power of Points 题意很简单:从左到右取点,输出该点到每个点的距离之和 思路: 1.对一个有序的序列进行计算,我们发现从左往右,左边点数的距离会增加,右边点数的距离会减小 2.因此我们只需暴力的计算第一个点到所有点的距离之和,接下来的点只需一步就可计算出来 2.1 ans+=左边 ......
wasting time on the internet
The University of Pennsylvania 2014年推出了这么一个课程,就是学生必须胡乱上网3小时,去浪费时间。每个人接触互联网之后,每天在网上消磨得时间岂止3小时。这两天看亚运会,暂停叫做time out,我觉得这个词用的特别好,我们的人生的正事可以叫做in, 可以是你的学业, ......
Codeforces Round 730 (Div. 2) B. Customising the Track
有 \(n\) 条高速公路,第 \(i\) 条告诉公路上的车流为 \(a_i\) 。现在可以执行以下操作任意次: 将第 \(i\) 条高速公路上的一辆车移到第 \(j\) 条高速公路。 需要求最小的 \(\sum_{i = 1}^{n}\sum_{j=i+1}^{n} |a_i - a_j|\) 。 ......
UVA10054 The Necklace 题解
好可恶一道题,怎么没人告诉我输出之间有空行( 思路是先抽象成图,然后跑一边dfs记录边的前后顺序。 对于不能成环的情况,只需要再开个数组记录度数判断奇点即可。 若存在奇点则break掉,剩下的跑dfs、 //produced by miya555 //stupid mistakes:1.多测要清空 ......
The 2022 ICPC Asia Shenyang Regional Contest
C. Clamped Sequence 因为\(n\)的范围不大,并且可以猜到\(l,r\)中应该至少有一个在\(a_i,a_i-1,a_i+1\)上。所以直接暴力枚举\(l\)或\(r\)然后暴力的计算一下 #include <bits/stdc++.h> using namespace std; ......
为什么在es6中继承必须调用super函数?
在ES6中规定,子类的构造函数必须要执行super函数 图片查阅自 阮一峰 ES6教程 super()函数有什么作用? 在执行super函数时,其实就是在创建子类的this,然后将父类的实例和方法放置在这个this对象中,子类在调用super之前是没有this的,所有的this操作都要在super( ......
P5299 [PKUWC2018] Slay the Spire
P5299 [PKUWC2018] Slay the Spire 洛谷:P5299 [PKUWC2018] Slay the Spire LOJ:#2538. 「PKUWC2018」Slay the Spire 前言:请分清楚 使用 和 抽取。九条要 抽取 \(m\) 张牌,但只会 使用 \(k\) ......
The name org.freedesktop.secrets was not provided by any .service files 报错问题
在搭建cicd docker 靶场的时候出现这个问题,由于是第一次遇到,就想记录下来 通过各种搜索资料搜索 发现只要安装如下包就没问题 1 apt -y install gnome-keyring 这样做之后,一切都可以 这样就可以了 ......
CF1575I Illusions of the Desert
prologue 还是太菜了,这个 154 行的树剖20min才敲完。 analysis 首先,处理这个给到我们的这个式子。 \[\max(\mid a _ u + a _ v \mid, \mid a _ u - a _ v \mid) \]我们可以分类讨论: \(a > 0, b > 0\): ......
The solution of P3012
problem & blog 很明显是个 DP。 于是我们定义 \(dp_{i,j,k}\) 为末尾的字符的 ASCII 码为 \(i\),有 \(j\) 个大写字母,\(k\) 个小写字母。 然后在枚举能接在 \(i\) 之后所有字母即可。 然后考虑 \(dp_{i,j,k}\) 给后面的 DP ......
The 2022 ICPC Asia Xi'an Regional Contest
C. Clone Ranran 最优解一定是先复制,在做题。最多只需要复制大约 30 次,直接枚举即可 #include <bits/stdc++.h> using namespace std; #define int long long int a , b, c; void solve(){ ci ......
Go - Logging to the System Log Service
Problem: You want to log in to the system log instead of your logfiles. Solution: Use the log/syslog package to write to syslog. Syslog is a standard ......
The solution of ABC144F
都不知道什么时候做的题了 problem & blog 一开始很容易想到枚举断边然后 DP 算代价。 于是很容易想到 DP 状态定义:设 \(dp_u\) 为从 \(u\) 出发到 \(n\) 的期望步数。 那么显然有 \(dp_u = \sum^{v_n}_{v_1} \dfrac{dp_{v_{ ......
vue_error_Runtime directive used on component with non-element root node. The directives will not function as intended
翻译: '运行时指令,用于非元素根节点的组件。这些指令将无法发挥预期的作用'; 这个错误发生在我将v-show放在自定义组件上时, 我想是因为自定义组件在渲染时会被自定义组件的内部元素替换, 因此设置是无效的 解决: 在自定义组件外加一个div, 把v-show写在div上 ......
Go - Change What Is Being Logged by the Standard Logger
Problem: You want to change what the standard logger logs. Solution: Use the SetFlags function to set flags and add fields to each log line. The defau ......
Gym 104270 The 2018 ICPC Asia Qingdao Regional Programming Contest (The 1st Universal Cup, Stage 9: Qingdao)
A. Sequence and Sequence B. Kawa Exam 可以发现,对答案会产生影响的只有割边,把所有边双缩起来,然后就是一个森林。 考虑一个树的时候怎么做,就是对于每条边求出这条边两端的众数个数,考虑线段树合并,每次动态维护子树内的众数和子树外的众数。 #include<iost ......
Go - Using Multiple Versions of the Same Dependent Packages
Problem: You want to use multiple versions of the same dependent packages in your code. Solution: Use the replace directive in the go.mod file to rena ......
Road of the King
2023-09-28 题目 Road of the King 难度&重要性(1~10):8.5 题目来源 luogu 题目算法 (纯)dp 解题思路 一道非常好而有意思的题目,码量巨短。 首先观察数据范围,发现是 \(n\le 300\),考虑 \(O(n^3)\) 的 dp。 主要的难点在于如何去 ......
2023 ICPC 网络赛2 L Super-palindrome 字符串 border KMP dp
传送门 给出一个\(5000\)长的字符串 判断有多少个连续子串是超级回文的。 这里超级回文的定义是将字符串分成\(2k\)段每段按照回文对应相等。 设\(f_{l,r}\)表示区间\(l,r\)是否是符合要求的。引入\(border\)的定义:最长的前缀和后缀匹配长度。 容易想到我们如果暴力枚举每 ......
pip安装包报错:PS C:\Users\Administrator\Desktop> pip install request ERROR: Could not find a version that satisfies the requirement request (from versions: none)
PS C:\Users\Administrator\Desktop> pip install requestERROR: Could not find a version that satisfies the requirement request (from versions: none)ERRO ......