beautiful
(补题)CF1348B. Phoenix and Beauty
CF1348B. Phoenix and Beauty 思路 最后输出的一定是一个周期为k的数值。我们只需要查看输入进来的数组中的元素的种类和k的关系即可。元素种类大于k输出-1;小于等于k,输出每个不同的元素,不够k个的话就用1补齐 ac代码 #include <bits/stdc++.h> us ......
8 You Are So Beautiful
如果要是子数组唯一,没有子序列与之相同,那么就要找同一个字母的第一个出现的位置和最后一个出现的位置 #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e5+10; int a[N]; voi ......
致21岁的自己——May all the beauty be blessed.
[错峰跨年第一弹]长文预警,本文长达不知道多少字(本文同时发布于博客园)先说一下,博客园快要倒闭了233说起博客园又得提一嘴他的好朋友csdn,so f**k you csdn,盗我博客不得house每年到这个时候都是最忙的时候,期末周(月)加课设,画图画得焦头烂额,机械工程狗都不学。这一年倒是身体 ......
Codeforces Round 638 (Div. 2)B. Phoenix and Beauty
B. Phoenix and Beauty 这道题目学到的东西: 从给出的数据范围观察,得到一些有用信息(峰哥教的) 考虑无解的情况‘ 其实这题考虑怎么操作是比较难的,如果能想出来满足条件的结果就比较好了(我在说什么我自己也不知道,算了直接看下面的图吧) 假设\(k=3\),下面是我们得到的结果数列 ......
React拖拽插件:react-beautiful-dnd
本篇文章主要介绍react-beautiful-dnd,它是基于react的拖拽插件 接下来会从以下几个方面来介绍react-beautiful-dnd 安装使用 API介绍 Example 1. 安装使用 首先我们需要安装react-beautiful-dnd # yarn yarn add re ......
Codeforces Round 910 (Div. 2) D. Absolute Beauty(数论)
Codeforces Round 910 (Div. 2) D. Absolute Beauty 思路: 将每个 \(a_i\) 与 \(b_i\) 转化为线段,大数在后,小数在前 即 L ( min) —— R (max) 对于 \(b_i\) 和 \(b_j\) 的 交换 : L1 —— R ......
CodeForces 1904F Beautiful Tree
洛谷传送门 CF 传送门 大家好,我是这个。 注意到可以树剖后线段树优化建图跑拓扑排序,但是空间复杂度 \(O(n \log^2 n)\),大概过不了。 注意到我们只会有一个 \(\text{dfn}\) 区间不是一条重链上一段前缀的形式(跨过 \(\text{LCA}\) 的那个区间),于是对这个 ......
20.Explain how the following reasoning fails to address the complexity of the issue involved, and rebut it. “Sanya is warm all year round and has beautiful beaches,
Round 1: Identifying the Failure in Reasoning Speaker 1 (Student A): Hello, everyone! Let's kick off our discussion by examining the reasoning: "Sanya ......
CF55D Beautiful numbers
题意 给定序列 \(S\)。 求满足以下性质的 \(S\) 的排列的数量: \(\max_{j = 1} ^ {i - 1} s_j \ge 2 \times s_i\) 或 \(\max_{j = 1} ^ {i - 1} 2 \times s_j \le s_i\)。 Sol 排个序先。 设 \ ......
Count Beautiful Substrings II
Count Beautiful Substrings II You are given a string s and a positive integer k. Let vowels and consonants be the number of vowels and consonants in a ......
Netherlands: Soil Protection Act to keep tulips beautiful
Soil pollution management in the Netherlands has three characteristics. Although the natural environment, population and development conditions of the ......
CF1898 D Absolute Beauty 题解
Link CF1898 D Absolute Beauty Question 给出两个长度都为 \(n\) 的数组 \(a,b\) ,我们可以任意选择两个数 \(i,j\) 交换 \(b_i\) 和 \(b_j\) 一次,或者不换 求 \(\sum\limits_{i=1}^n |a_i-b_i|\ ......
CF1898D - Absolute Beauty(绝对值)
题目地址 Solution 考虑把 \(|a_i-b_i|\) 转化为数轴上的线段的一条线段,那么 \(swap\) 操作可以形象转化为下图(借用官方\(Editoral\)) 考虑最大的增加(第一张图的情况)即可。 Summary 学到了 绝对值转线段,把指定操作形象化,数形结合(雾 ......
PyCharm - Beautiful Soup
介绍 Beautiful Soup 主要是用来解析提取 HTML 和 XML 文件中的数据。 现在官网推荐使用 Beautiful Soup 4 ,已经被移植到了BS4中。 安装 Beautiful Soup:pip instal beautifulsoup4 使用格式: 实例化 Beautiful ......
[题解] P4755 Beautiful Pair
P4755 Beautiful Pair 给你一个长度为 \(n\) 的序列 \(a\),求有多少个区间 \([l, r]\) 满足 \(a_l \cdot a_r \le \max_{i = l}^r a_i\)。 \(n \le 10^5, a_i \le 10^9\)。 首先按最大值位置分治。 ......
题解 P4755 Beautiful Pair
洛谷。 题意 显然。 分析 首先考虑到分治,那么问题就在于如何维护经过某个结点的方案数。 利用从中间结点向两端的前缀后缀最大值,接下来我们对左端点的每一个结点考虑连向右侧的方案数。 考虑分类讨论,令左端点为 \(i\),右端点为 \(j\)。 假如 \(mx_i> mx_j\),那么我们整个区间的最 ......
Codeforces Round 905 (Div. 2) C. You Are So Beautiful
题面翻译 给定数列 \(a\),定义一个子序列 \(S\) 是合法的当且仅当从 \(a\) 中有且仅有一种选法能选出子序列 \(S\)(选法相同定义为最终选出的位置集合相同)。 求其有多少非空合法子序列,满足它占据了 \(a\) 中一端连续的区间。 \(n\leq 10^5\)。 思路 判断区间合法 ......
Codeforces Round 905 (Div. 2) C. You Are So Beautiful(数据结构)
Codeforces Round 905 (Div. 2) C. You Are So Beautiful 定义: 设数组 abcd 子数组定义:从原数组砍去前面若干元素,后边若干元素,剩余的数组。如:bc、ab 子序列定义:从原数组删除若干元素,剩余元素拼凑一起,组成的数组。如:ac、bd 思路: ......
CF1883F You Are So Beautiful
思路 最开始都错题了,以为是不能通过另一种子串的选择方法得到这个子串就算做独特字串,实际上,是需要不能通过选择子序列的方式得到这个子串才满足条件,导致赛时没做出来(悲)。 实际上,如果一个子串满足条件,那么一个必要条件就是子串左侧没有与该子串左端一样的数字并且子串右侧也没有与该子串右端一样的数字。 ......
Educational Codeforces Round 150 (Rated for Div. 2) B. Keep it Beautiful
数组 \(a = [a_1, a_2, \cdots, a_n]\) 被称为是美丽的,如果可以将 \([1, x]\) 段移到 \([x + 1, n]\) 段后面,\(x \geq 0\) ,数组可以构成非降序。 现在有一个数组 \(a\) (一开始为空)和 \(q\) 个询问,第 \(i\) 个 ......
CF1264D2 Beautiful Bracket Sequence
第二次听这道题,写个推导过程。 考虑对于给定的括号序列如何算答案,考虑最终答案对应回原序列的位置,于是我们要找到一个位置让其左边的左括号与右边的右括号一样多。因为挪指针时两者之一一定变化,并且两边均单调,所以这个分界点是唯一的。 考虑枚举分界点算答案。假设左边有 \(x\) 个问号,右边有 \(y\ ......
ABC324F Beautiful Path
给出一张 DAG,每条边有两种边权 \(b\) 与 \(c\),求一条从 \(1\) 到 \(n\) 的路径,问路径经过的边的 \(\dfrac{\sum b}{\sum c}\) 的最大值是多少。 \(n, m \le 2 \times 10^5\)。 这不是经典 01 分数规划吗?将题目中的要求 ......
Atcoder Beginner Contest 324 F Beautiful Path 题解-分数规划
为了更好的阅读体验,请点击这里 分数规划小技巧:尽可能将式子写成存在某种取值,使得不等式成立的形式。 不然可能需要绕几个弯才能想出来。 题目链接 题目大意:给出一个 DAG,每条边有一个 \(b_i, c_i\),保证从编号小的边向编号大的边连边,且 \(1\) 到 \(n\) 必有路径,求 \(1 ......
2023-1-0xpython_beautiful_soup
+++ title = "python_beautiful_soup" description = "" date = 2023-03-20T15:50:22+08:00 featured = false comment = true toc = true reward = true categor ......
[CF1264D]Beautiful Bracket Sequence
题目描述 This is the hard version of this problem. The only difference is the limit of $ n $ - the length of the input string. In this version, $ 1 \leq n ......
Beautiful Pair
Beautiful Pair 简要题意: 给出一个长度为 \(n\) 的序列。要求它的子串中,满足左右端点之积小于等于子串中的最大值的个数。 思路 肯定要求出不同的 \([l,r]\) 中的最大值。显然一个一个枚举区间会超时。所以考虑当 \(a_i\) 作为最大值的时候,会产生哪些区间,这些区间满足 ......
[ABC248Ex] Beautiful Subsequences
### 题意 给定排列 $ P_n $ 和整数 $ k $,求满足如下条件的点对 $ (l, r) $ 数量。 * $ 1 \le l \le r \le n $。 * $ \max_{i = l}^rP_i - \min_{i = l}^rP_i \le r - l + k $。 ##### 数据 ......
Number of Beautiful Integers in the Range
Number of Beautiful Integers in the Range You are given positive integers low, high, and k. A number is beautiful if it meets both of the following co ......
ABC248Ex Beautiful Subsequences
![](https://cdn.luogu.com.cn/upload/image_hosting/rft7d5d2.png) 然而这个经典做法是分治,我不太会做,但这确实是一道经典题。 考虑扫描线,对从左到右每个点 $r$,统计以 $r$ 作为右端点的区间个数。 由于 $r$ 端点固定,$S(l) ......