合集-日常训练
摘要:2025.2.19——1500 A 1500 B 1500 C 1500 D 1500 思维/图论+位运算/思维+数学/思维+构造/思维 A 存在路径即在一个连通块。 加上必须加的边,删去必须要删去的边。并查集维护查询,考虑一下删边和加边的先后顺序。 B 位运算入手点当然是单独考虑每一位。发现三个数
阅读全文
摘要:codeforces Q1.1200 将一个序列分为若干集合,每个集合的和在一个区间内,问集合数量的最大值。 Q2.1400 长度为n的数组产生n-2个相邻三元组,问恰有1个元素不同的三元组的配对数。 Q3.1500 给定n个数组,设f(x)=max{任意次将x放入任意数组:x=mex{x,a[i]
阅读全文
摘要:codeforces Q1. 1100 给定01字符串a,b,长度n,n-1,遍历b每次任意选择a中a[i]!=a[i+1],将a[i]a[i+1]替换为b[i],长度减一,问是否能完成n-1次操作。 Q2. 1300 给定n,是否能构造出长度为n的序列,其中每个元素出现>1次且任意相同元素的距离为
阅读全文
摘要:11.25 周一 日常 Q1. 1200 给定x,y,k,k次操作,每次操作:x++,若x可被y整除,x一直除以y。问最终x的值。(x,y,k≤1e9) Q2. 1400 给定一等差数列a,每次操作:令最大值=mex{a}。问是否可以将a变成0~n-1的排列和最小操作次数。(1e18) Q3. 16
阅读全文
摘要:2024.11.26 周二日常 Q1. 1200 给定一数组k(代表n个人的倍率),设在每个人上投资为xi,若其胜利则获k*xi,最终一人胜利。问是否可以保证无论谁胜利,收益大于总投资的方案。(n<=20,k<=50) Q2. 1300 给定一数组,问最小的k使所有长度为k的区间按位或相等。 Q3.
阅读全文
摘要:2024.11.27 周三 Q1. 1000 给定x,y,设ai=i^x,bi=i^y,问两个无穷序列a和b的最长公共子序列的长度。 Q2. 1400 给定一条链,所有点未激活,在开始点放一棋子并激活,2人轮流操作:将棋子移动到相邻的未激活的点并激活。不能操作者输。问均最优策略的赢家。 Q3. 16
阅读全文
摘要:2024.11.28周四 Q1. 1200 给定a,b。构造一数组,满足平均值为a,中位数为b。 Q2. 1300 给定4个数字,输出1~5中未出现的数字。 Q3. 1500 给定一数组,每次操作你可以选择一个元素ai在数组右边添加i-1个0。问任意操作数组长度的最大值。 A1. 9mins 考虑等
阅读全文
摘要:2024.11.29 周五 Q1. 1200 给定黑白保龄球a,b个,设合法摆放为:金字塔形状,每层个数1,2,3...,且每层颜色相同。问最多可合法摆放层数的数量。 Q2. 1400 三种特定的木头长度18,21,25,一根长度为60的木头可以截成多段。分别需要n根长度为18,21,25的木头,问
阅读全文
摘要:2024.11.30 周六 Q1. 1200 给定x(<=107),m(<=1018),循环i:1~m,t=i^x,问t为x或m因子的数量。 Q2. 1400 给定n个数,选择四个坐标点组成一个边平行于坐标轴的矩形,问面积最大时选的点。 Q3. 1600 给定一数组(非负),在非零数中每次可选一个数
阅读全文
摘要:2024.12.1 周日 Q1. 1000 对于字符串p,对定义f(p):p的所有连续子串中去重后的数量。 给定字符串s,问其是否存在一个子串t满足f(t)为偶数。 Q2. 1200 给定一数组,操作:选择一区间[l,r],将此区间的所有数变成所有数的中位数。 问最终数组变成相同数的最大值。 Q3.
阅读全文
摘要:2024.12.2 周一 Q1. 1100 给定一个数字(32位以内),使用1,0,-1构造二进制数位,同时保证不能有相邻的非0数存在。 Q2. 1200 给定2个相同数位的数(<=1e100),任意操作:交换2数中相同位的数字使两数之积最大。 Q3. 1300 前缀后缀板题 Q4. 1400 给定
阅读全文
摘要:2024.12.3 周二 Q1. 1100 给定两个长度为n和n+1的数组a,b。每次操作:选择a的任意一个数 +1/-1/复制到末尾。 问将a变成b的最小操作次数。 Q2. 1200 设定一个数组是美丽的:当其可以通过任意次操作将数组里的数变成同一个数字,操作:如果a[i-1]==a[i+1],则
阅读全文
摘要:2024.12.4 周三 Q1. 1000 给定01串,操作:选择l,r,将s[r]放到s[l]前:s[l]s[l+1]...s[r-1]s[r]->s[r]s[l]s[l+1]...s[r-1],代价为r-l+1/区间长度。 问最小代价将01串由小到大排序。 Q2. 1300 给定2行'<''>'
阅读全文
摘要:2024.12.5 周四 Q1. 1000 给定x2~xn(<=500),构造a1~an,满足i:2~n,x[i]==a[i]%a[i-1]。 Q2. 1200 n户人家在一条线上,现在在某两户i,i+1之间/两端修建一条公路,给定一01串:0代表希望在公路左边,1则相反。 要求两侧都要有至少一半人
阅读全文
摘要:2024.12.7 周六 Q1. 1000 给定01字符串,n,m,k。任意操作将区间长度为k的子串字符全变为1。问保证字符串任意区间没有长度大于等于m的子串字符全为0的最少操作次数。 Q2. 1300 有一个正 n 边形,给定x 个关键点,在关键点两两之间任意连互相不交叉的对角线,使得整个图形被划
阅读全文
摘要:2024.12.8 周日 Q1. 1100 给定n,k。构造长度为n的数组,元素之和为k,且按位或和的值在二进制下1最多。 Q2. 1300 给定两行01串,从(1,1)走到(2,n),每次只能向右或向下走。问路径经过的最小字符串以及方案数。 Q3. 1200 将一个数组分为连续的k>1段,使每段的
阅读全文
摘要:2024.12.9 周一 Q1. 1000 问是否可以用给定的n^2个数构造出已定n*n的矩阵。 Q2. 1200 给定2行n列数组,从(1,1)走到(2,n),只能向右/下走。你可以任意交换2列,问经过元素的和的最大值。 Q3. 1200 你有任意张面值为1,3,6,10,15的纸币。给定n,问凑
阅读全文
摘要:2024.12.10 周二 Q1. 1100 给你一个序列,你可以对这个序列中的每个数(0<=ai<100)进行拆分,使得最后整个序列单调不递减,询问是否有解。 Q2. 1200 给定一数组,可任意改变顺序,问是否可使a1%a2%a3%...%an!=0。 Q3. 1300 给定数组a,数字x,y。
阅读全文
摘要:2024.12.11 周三 Q1. 1100 给定一长度为 $n$ 的数组,你需要执行 $k$ 次操作:每次选择一连续子数组(可为空),将和作为一元素放到到数组的任意位置。问最后数组和的最大值。 Q2. 1100 给你一长度为$2n$的数组$a$,$1$~$n$各出现2次。让你找出两个大小为$2k$
阅读全文
摘要:2024.12.12 周四 Q1. 1000 You have an array $a$ of $n$ integers. You can no more than once apply the following operation: select three integers $i$, $j$,
阅读全文
摘要:2024.12.13 周五 Q1. 1000 Polycarp has a problem — his laptop keyboard is broken. Now, when he presses the 'b' key, it acts like an unusual backspace: it
阅读全文
摘要:2024.12.14 周六 Q1. 1000 You are given two strings $a$ and $b$ of equal length, consisting of only characters 0 and/or 1; both strings start with charac
阅读全文
摘要:2024.12.16 周一 Q1. 1000 Monocarp is playing yet another computer game. And yet again, his character is killing some monsters. There are $n$ monsters, n
阅读全文
摘要:2024.12.17 周二 Q1. 1000 Jonathan is fighting against minions. There are $n$ of them with strengths $a_1, a_2, \dots, a_n$. Denote $(l, r)$ as the group
阅读全文
摘要:2024.12.18 周三 Q1. 1000 You have an array of zeros $a_1, a_2, \ldots, a_n$ of length $n$. You can perform two types of operations on it: Choose an inde
阅读全文
摘要:2024.12.19 周四 Q1. 1000 Consider a $2 \times n$ grid, where $n$ is an even integer. You may place the integers $1, 2, \ldots, 2n$ on the grid, using ea
阅读全文
摘要:2024.12.20 周五 Q1. 1000 Ethan runs a vaccination station to help people combat the seasonal flu. He analyses the historical data in order to develop an
阅读全文
摘要:2024.12.21 周六 Q1. 1000 Lottery "Three Sevens" was held for $m$ days. On day $i$, $n_i$ people with the numbers $a_{i, 1}, \ldots, a_{i, n_i}$ particip
阅读全文
摘要:2024.12.22 周日 Q1. 1100 You are playing a computer game. The current level of this game can be modeled as a straight line. Your character is in point $
阅读全文
摘要:2024.12.23 周一 Q1. 1100 Alice and Bob are playing a game. They have an array $a_1, a_2,\ldots,a_n$. The game consists of two steps: First, Alice will r
阅读全文
摘要:2024.12.24 周四 Q1. 1100 You are given an array $a$ of $n$ positive integers and a score. If your score is greater than or equal to $a_i$, then you can
阅读全文
摘要:2024.12.25 周三 Q1. 1100 A subarray is a continuous part of array. Yarik recently found an array $a$ of $n$ elements and became very interested in findi
阅读全文
摘要:2024.12.26 周四 Q1. 1100 There is a ribbon divided into $n$ cells, numbered from $1$ to $n$ from left to right. Initially, an integer $0$ is written in
阅读全文
摘要:2024.12.27 周五 Q1. 1100 Alex is participating in the filming of another video of BrMeast, and BrMeast asked Alex to prepare 250 thousand tons of TNT, b
阅读全文
摘要:2024.12.28 周六 Q1. 1100 You are given two integers $l \le r$. You need to find positive integers $a$ and $b$ such that the following conditions are sim
阅读全文
摘要:2024.12.29 周日 Q1. 1100 You are given a number in binary representation consisting of exactly $n$ bits, possibly, with leading zeroes. For example, for
阅读全文
摘要:2024.12.30 周一 Q1. 1100 Farmer John has a permutation $p_1, p_2, \ldots, p_n$, where every integer from $0$ to $n-1$ occurs exactly once. He gives Bess
阅读全文
摘要:2025.1.5——1200 Q1. 1200 Kevin discovered a binary string $s$ that starts with 1 in the river at Moonlit River Park and handed it over to you. Your tas
阅读全文
摘要:2025.1.12——1200 Q1. 1200 You are given a sequence \(a\), consisting of \(n\) integers, where the \(i\)-th element of the sequence is equal to \(a_i\).
阅读全文
摘要:2025.1.14——1200 Q1. 1200 You have \(n\) sticks, numbered from \(1\) to \(n\). The length of the \(i\)-th stick is \(2^{a_i}\). You want to choose exac
阅读全文
摘要:2025.1.15——1200 Q1. 1200 简单来说就是给定3个数组,每个数组选择一个数,三者下标不同,问三者和的最大值。 Winter holidays are coming up. They are going to last for \(n\) days. During the holi
阅读全文
摘要:2025.1.16——1200 Q1. 1200 You are given \(3\) integers — \(n\), \(x\), \(y\). Let's call the score of a permutation\(^\dagger\) \(p_1, \ldots, p_n\) th
阅读全文
摘要:2025.1.17——1200 Q1. 1200 Jellyfish has \(n\) green apples with values \(a_1, a_2, \dots, a_n\) and Gellyfish has \(m\) green apples with values \(b_1,
阅读全文
摘要:2025.1.18——1300 A 1300 There are \(n\) cities located on the number line, the \(i\)-th city is in the point \(a_i\). The coordinates of the cities are
阅读全文
摘要:2025.1.19——1300 A 1300 You are given an array \(a\) consisting of \(n\) positive integers. You can perform the following operation on it: Choose a pai
阅读全文
摘要:2025.1.20——1300 A 1300 You are given a binary string \(s\). A binary string is a string consisting of characters 0 and/or 1. You can perform the follo
阅读全文
摘要:2025.1.21——1300 A 1300 Qingshan has a string \(s\) which only contains \(\texttt{0}\) and \(\texttt{1}\). A string \(a\) of length \(k\) is good if an
阅读全文
摘要:2025.1.22——1300 A 1300 Your friends have an array of \(n\) elements, calculated its array of prefix sums and passed it to you, accidentally losing one
阅读全文
摘要:2025.1.24——1400 A 1400 Two players are playing an online card game. The game is played using a 32-card deck. Each card has a suit and a rank. There ar
阅读全文
摘要:2025.1.26——1400 A 1400 B 1400 2024年最后一篇 A 发现和区间非1之和与1的个数大小有关。前缀维护两个信息即可。 B 找到一种构造方式为:来回摆动构造。 代码 A #include <bits/stdc++.h> #define int long long // #d
阅读全文
摘要:2025.2.8——1400 A 1400 B 1400 思维+贪心。 A 入手点是考虑每行/列之和为多少。 B 较难的贪心。 入手点是转化问题分析方式:分割为两个数组理解为按顺序向两个空数组添加。 代码 A #include <bits/stdc++.h> #define int long lon
阅读全文
摘要:2025.2.9——1400 A 1400 B 1400 C 1400 D 1400 E 1400 二进制/贪心+博弈/结论+结论/贪心/栈+二分+字符串 A 入手:分别考虑每一位。 关键:贪心。 巧妙:交换。 B 关键:换一种方式考虑每一个选与不选对答案的影响,从而发现结论。 C 入手:\(n==
阅读全文
摘要:2025.2.10——1400 A 1400 B 1400 C 1400 D 1400 思维+前缀+数学+贪心/结论 A 入手点:发现 \(k>2\) 时答案为0。 关键点:考虑 \(k==1 / k==2\) 时即可。 巧妙点:\(low\_bound\) 去寻找第一个大于与小于指定值的数。 B
阅读全文
摘要:2025.2.14——1400 A 1400 B 1400 C 1400 D 1400 E 1400 F 1400 G 1400 H 1400 思维+排序/双指针/二分/队列匹配+思维+二分/位运算+思维+数学+思维 A 一眼想到的是维护信息计数。 维护两个信息同时用长的一半去找短的一半。 较好的思
阅读全文
摘要:2025.2.15——1400 A 1400 B 1400 C 1400 思维+位运算+思维/数学 A 单独对一个数进行分析什么情况下会有贡献。 在前面且所有比其小的数,都必须是最小前缀。 两个树状数组记录小的个数和最小前缀的个数。遍历维护信息可以做到不使用树状数组(思维点)。 B 模拟发现可以获得
阅读全文
摘要:2025.2.17——1400 A 1400 B 1400 C 1400 二分+构造+字符串/贪心/思维。CF的题就得多看透几层表面发掘本质。 A 一眼单调性。 分析后可以二分答案。 B 本质是:\((j-i)|n,s[i]!=s[j]\) 。设想一个周期为 \(T\) 。 设最小的不能被 \(n\
阅读全文

浙公网安备 33010602011771号