codeforces contest problem 1553

CodeForces 1917F Construct Tree

洛谷传送门 CF 传送门 考虑形式化地描述这个问题。先把 \(l\) 排序。然后相当于是否存在一个 \(\{1, 2, \ldots, n\}\) 的子集 \(S\),使得: \(\sum\limits_{i \in S} l_i = d\)。 \(\exists T \subseteq S, \m ......
CodeForces Construct 1917F 1917 Tree

Codeforces Round 915 (div2) E

E. Tree Queries [题目链接](https://codeforces.com/contest/1904/problem/EProblem - E - Codeforces) 题意概括: 给定一棵大小为 \(n\) 的树,回答如下询问,询问之间相互独立: 给定一个点 \(x\) 与 \( ......
Codeforces Round div2 915 div

codeforces刷题(1100):1917B_div2

模板 B、Erase First or Second Letter 跳转原题点击此:该题地址 1、题目大意 给你一个字符串,可以执行任意次以下操作,生成最终的字符串(不可为空),问你能生成的不重复字符串数为多少。 操作一:删除字符串第一个字符; 操作二:删除字符串第二个字符。 2、题目解析 发现,操 ......
codeforces B_div 1100 1917 div

Codeforces 1909G - Pumping Lemma

这个题思考角度很多,做法也很多。这里介绍一种 @asmend 和我讲的做法。 设 \(d=m-n\),那么我们枚举 \(|x|=i,|y|=j\),设 \(s,t\) 的 LCP 长为 \(l_1\),LCS 长为 \(l_2\),那么可以得到这组 \((i,j)\) 合法的充要条件是: \(i\l ......
Codeforces Pumping 1909G Lemma 1909

UNIQUE VISION Programming Contest 2023 Christmas (AtCoder Beginner Contest 334)

UNIQUE VISION Programming Contest 2023 Christmas (AtCoder Beginner Contest 334) A - Christmas Present 代码: #include <bits/stdc++.h> using namespace std ......

Codeforces1917F - Construct Tree

Codeforces1917F - Construct Tree Problems 给一个长度为 \(n\) 的序列 \(l\) 和 \(d\)。 要求判断是否可以构造出一颗节点数为 \(n+1\) 的树,满足 \(l\) 的每一个元素唯一对应为一条边的长度,并使整棵树的直径长度恰好为 \(d\)。 ......
Codeforces Construct 1917F 1917 Tree

CodeForces 1906K Deck-Building Game

洛谷传送门 CF 传送门 UNR #2 黎明前的巧克力。 枚举两个人选的卡的并集 \(S\),那么当 \(\bigoplus\limits_{i \in S} a_i = 0\) 时 \(S\) 有贡献 \(2^{|S|}\)。 考虑将 \(2^{|S|}\) 分摊到每个元素上,也就是每个元素有 \ ......
Deck-Building CodeForces Building 1906K 1906

CF1909F1 Small Permutation Problem (Easy Version)

给定一个长度为 \(n\) 的数组 \(a\),其中 \(a_i \in [1, n]\),试计算满足以下条件的 \([1, n]\) 的排列 \(p\) 的个数: \(\forall i \in [1, n], \sum_{1 \le j \le i} [p_j \le i] = a_i\) \( ......
Permutation Problem Version 1909F Small

CF1909F2 Small Permutation Problem (Hard Version)

给定一个长度为 \(n\) 的数组 \(a\),其中 \(a_i \in [-1, n]\),试计算满足以下条件的 \([1, n]\) 的排列 \(p\) 的个数: \(\forall i \in [1, n], \text{有 }\sum_{1 \le j \le i} [p_j \le i] ......
Permutation Problem Version 1909F Small

【模版】高精度减法 (A - B problem)

直接看代码和注释吧qwq高精度就是模拟嘛ww 还是python好,自带高精度 #include<bits/stdc++.h> #define MAXN 10500 using namespace std; string a, b; //选择字符串。因为字符串储存了每个串的长度,可以直接调用。 int ......
高精 减法 高精度 模版 problem

AtCoder Regular Contest 168 E Subsegments with Large Sums

洛谷传送门 AtCoder 传送门 尝试二分答案,问题变为要求恰好选 \(x\) 段 \(\ge s\),最大化选的段数。 发现我们不是很会算段数的 \(\max\),因为要求段不重不漏地覆盖 \([1, n]\)。考虑给每个 \(\ge s\) 段 \([l, r]\) 一个 \(r - l\) ......
Subsegments AtCoder Regular Contest Large

Codeforces1917E - Construct Matrix

Codeforces1917E - Construct Matrix 首先考虑因为 \(n\) 为偶数,所以 \(k\) 为奇数时不可能满足条件。 其次,如果 \(4|k\),那么实际上在矩阵中一直放 \(2\times 2\) 的全为 \(1\) 的矩阵就可以了。 随后,如果 \(k \equiv ......
Codeforces Construct Matrix 1917E 1917

【模版】高精度乘法 (A*B problem)

和A+B problem类似 ,不多说,直接看代码和注释就好啦!ww 感觉这东西只要有个概念就行了...就是在练模拟?www其他语言似乎有大数加减乘除? 这样的高精度算法时间复杂度O(n2),n是数字位数,如果位数过大还是很慢。可以利用快速傅里叶变换的方式加速高精度乘法。(虽然都是我连傅里叶级数都没 ......
高精 乘法 高精度 模版 problem

Codeforces Round 917 (Div. 2)

基本情况 A题秒了,B题卡了一年。 B. Erase First or Second Letter Problem - B - Codeforces 卡题分析 两方面原因 没有变通,一开始的思路是公式算出总字串数再想办法找重复的减掉,但搞了一个小时都不可行,应该早点换成正着来找的思路。 没有更深入的 ......
Codeforces Round 917 Div

codeforces刷题(1100):1907C_div3

C、Removal of Unattractive Pairs 跳转原题点击此:[该题地址](Problem - 1907C - Codeforces) 1、题目大意 给定一个字符串,可以删除相邻的两个不相等的字符。问你删除后能得到最小的字符串长度为多少。 2、题目解析 因为只要两个不相等的字符相邻 ......
codeforces C_div 1100 1907 div

CF contest 1909 Pinely Round 3 (Div. 1 + Div. 2) 题解(Vanilla的掉分赛)

[Pinely Round 3 (Div. 1 + Div. 2) - Codeforces](https://codeforces.com/contest/1909) $$ \color{purple}\large\textbf{世界上只有一种真正的英雄主义,} $$ $$ \color{red}... ......
题解 Div contest Vanilla Pinely

AtCoder Beginner Contest 333题解A-D

⭐Toyota Programming Contest 2023#8(AtCoder Beginner Contest 333) 前言: 好的,比赛的时候给比赛忘了,少跑二十多分钟,好在这次题目都比较简单,也算是迅速赶上了 顺带一提,为了赶时间貌似没有一题是用C++写的…… 模拟只会猜题意,贪心只能 ......
题解 Beginner AtCoder Contest 333

AtCoder Beginner Contest 334题解

⭐AtCoder Beginner Contest 334 前言: 比赛题目链接 --按照惯例只写了主要部分的代码-- 特别说明:Rust有一个竞赛用的输入库,并且写ABC是可以用的,但是平时写洛谷是用不了的,所以我自己写了一个cin(),凑活能用,代码见下: 读输入函数 fn cin() -> S ......
题解 Beginner AtCoder Contest 334

CodeForces 1909D Split Plus K

洛谷传送门 CF 传送门 设最后每个数都相等时为 \(t\)。那么一次操作变成了合并两个数 \(x, y\),再增加 \(x + y - k\)。于是每个 \(a_i\) 可以被表示成 \(b_i t - (b_i - 1)k\) 的形式,化简得 \(a_i - k = b_i (t - k)\)。 ......
CodeForces 1909D Split 1909 Plus

CodeForces 1909E Multiple Lamps

洛谷传送门 CF 传送门 感觉这个题比较难蚌。 发现按 \(1 \sim n\) 最后可以把 \(1 \sim n\) 中的所有平方数点亮。所以 \(n \ge 20\) 就直接输出 \(1 \sim n\)。 考虑 \(n \le 19\)。猜测合法的方案(即按完后亮灯数 \(\le \left\ ......
CodeForces Multiple 1909E Lamps 1909

CodeForces 1909F2 Small Permutation Problem (Hard Version)

洛谷传送门 CF 传送门 感觉这个题还是挺不错的。 考虑 F1。考察 \(a_i\) 差分后的意义,发现 \(a_i - a_{i - 1}\) 就是 \((\sum\limits_{j = 1}^{i - 1} [p_j = i]) + p_i \le i\)。 考虑将其转化为棋盘问题。在 \(( ......

AtCoder Beginner Contest 334 G Christmas Color Grid 2

洛谷传送门 AtCoder 传送门 考虑相当于把每个标记点的边全部断掉,然后求连通块个数。 考虑一条边 \((u, v)\)(设 \(u < v\))的出现时间,不难发现是 \([1, u - 1] \cup [u + 1, v - 1] \cup [v + 1, n]\)。于是考虑直接套线段树分治 ......
Christmas Beginner AtCoder Contest Color

AtCoder Beginner Contest 334

C. Socks 2 若 \(2\times n-k\) 为偶数,那么直接从小到大一对一对选即可。 若 \(2\times n-k\) 为奇数,则必定剩下一只。考虑不好知道到底剩下哪一只,那么直接暴力枚举剩第 \(i\) 只,则 \(1\sim i-1\) 和 \(i+1\sim n\) 的袜子搭配 ......
Beginner AtCoder Contest 334

AtCoder Beginner Contest 334

A - Christmas Present (abc334 A) 题目大意 给定两个数\(b,g(b \neq g)\),如果 \(b\)大则输出 Bat,否则输出Glove。 解题思路 比较大小输出即可。 神奇的代码 #include <bits/stdc++.h> using namespace ......
Beginner AtCoder Contest 334

Codeforces 1900E Transitive Graph

考虑题目的限制条件:存在 $a\to b, b\to c$ 的边,就会有 $a\to c$ 的边。 考虑 $p_{1\sim k}$,满足这 $k$ 个点按顺序组成了一个环且无重点。 那么 $p_1\to p_2, p_2\to p_3$,就有 $p_1\to p_3$,又有 $p_3\to p_4 ......
Codeforces Transitive 1900E Graph 1900

codeforces比赛(1):codeforces 916_div3

我的第一篇博客,虽然发布的都是非常简单的算法题,也没人看。我希望未来当我算法水平提高一个档次来看或许会有新的感受。这次cf比赛第一次写出来div3的D题,并且还剩余1小时,非常开心,一定继续保持下去。 ......
codeforces div3 916 div

kaggle Open Problems – Single-Cell Perturbations 1st & 2nd place solution summary

Leaderboard: https://www.kaggle.com/competitions/open-problems-single-cell-perturbations/leaderboard 2nd Solution: https://www.kaggle.com/competitions ......

CodeForces 331E2 Deja Vu

洛谷传送门 CF 传送门 考虑一条好的路径 \(x \to y\) 中一定至少存在一条边 \((u, v)\),满足这条边的序列 \(a\) 存在一个 \(j \in [1, |a| - 1]\),满足 \(a_j = u, a_{j + 1} = v\),就是说 \(a\) 包含一对相邻的 \(( ......
CodeForces 331E2 331E Deja 331

The 2022 ICPC Asia-East Continent Final Contest (EC-Final 2022)

比赛链接 没做完。 A. Coloring 有 \(n\) 个元素,第 \(i\) 个元素有价值 \(w_i\),颜色 \(c_i\)。给定 \(s\),初始时只有 \(c_s=1\),其余 \(c_i\) 均为 \(0\)。 可以进行任意操作:选择一个 \(1 \le i \le n\),花费 \ ......
Final 2022 Asia-East Continent EC-Final

P9361 [ICPC2022 Xi'an R] Contests

更好的阅读体验 P9361 [ICPC2022 Xi'an R] Contests 首先观察一下性质,每个 \(l\) 在每场比赛里一定是对应着某个前缀。 发现题目要求的是最小的满足要求的 \(l\),最暴力的大概是维护五个指针,每次答案 \(+1\),然后尝试跳一步,什么时候某个前缀包含了 \(x ......
Contests P9361 9361 2022 ICPC
共2500篇  :4/84页 首页上一页4下一页尾页