codeforces partition artistic 1603

Codeforces Round 899 (Div. 2)

Preface 好久没现场打CF了(玩CC玩的.jpg),但这场久违的打的还不错,把Kusanagi_Misuzu这个小号也打上橙了 虽然开场的时候状态不佳写的巨慢,但后面还是靠着ztc带我做出E1成功题数反超上大分 接下来要考虑启动第三个小号了,只敢打Div2的FW是这样的 A. Increasi ......
Codeforces Round 899 Div

Codeforces Round 738 (Div. 2) A. Mocha and Math

给一个数组 \(a_1, a_2, \cdots, a_n\) 。可以执行以下操作任意次: 选择 \(l, r (1 \leq l < r \leq n)\) ,对于任意 \(l \leq i \leq r\) ,同时执行所有 \(a_{l + i} = a_{l + i} \& a_{r - i} ......
Codeforces Round Mocha Math 738

Codeforces Round 899 (Div. 2) 记录

Codeforces Round 899 (Div. 2) A. Increasing Sequence 点击查看代码 #include<bits/stdc++.h> using namespace std; const int maxn=105; int t,n; //map<int,bool> ......
Codeforces Round 899 Div

Codeforces Round 898 (Div. 4)

这是我的vp,不是正真的contest. A: 不想多说,读者应该可以做到的!!! B: 让g=product(移除掉0的a): 如果有多过1个0答案肯定是0。 如果只是有1个0答案就是g。 没有0,答案就是max(g/a[i]*(a[i]+1)) 任何 i。 C: 没有仔细想那个profit的fo ......
Codeforces Round 898 Div

Codeforces Round 899 (Div. 2)

赛后四题 B题直接枚举不存在的元素即可 C题的trick有点像之前abc的某道题,对于奇数位置它一定可以贡献,对于偶数位置,如果它有数选了,那么它就能够贡献。 \(f[i]\)表示到前i个且至少选了一个的最大答案。 #include<cstdio> #include<algorithm> #incl ......
Codeforces Round 899 Div

Codeforces Round 738 (Div. 2) B. Mocha and Red and Blue

给一个字符串,包含字符 \(B\) , \(R\) ,\(?\) 。其中 \(?\) 可能为 \(B\) 或 \(R\) 。 规定不完美数为字符串中相同字符连续出现的次数,询问一个字符串的最少可能不完美数。 观察到 \(BR\) 或 \(RB\) 需要尽可能多,于是考虑尽可能让相邻字符不同。 容易证 ......
Codeforces and Round Mocha Blue

Codeforces Round 750 (Div. 2) B. Luntik and Subsequences

给一个数组 \(a_1, a_2, \cdots, a_n\) ,定义 \(s = \sum_{i = 1}^{n} a_i\) 。 询问有多少个 \(a\) 的子序列满足 \(\sum a_{i_k} = s - 1\) 。 显然要选出一个 \(1\) 不加入子序列,任意一个 \(0\) 可以加入 ......
Subsequences Codeforces Luntik Round 750

Codeforces Round 899 (Div. 2)

Codeforces Round 899 (Div. 2) A. Increasing Sequence 解题思路: 从左往右一个个看,从1开始,如果当前位相同\(+2\),否则\(+1\)。 代码: #include <bits/stdc++.h> using namespace std; usi ......
Codeforces Round 899 Div

Educational Codeforces Round 155 D (CF1879_D)

题目大意 给一个长度为 \(n\) 的数组,求 \(\Sigma_{i=1}^{n} \Sigma_{j=i}^{n} 区间异或和 \times (j-i+1)\) 其中 \(n\leq 3e5,~a[i]\leq 1e9\) 分析 首先注意到由 \(l\) 到 \(r\) 的区间异或和可以转化为 ......
Educational Codeforces Round 1879 155

Codeforces Round 898 (Div. 4)

A. Short Sort #include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int t; cin >> t; for( string s ; t ; t -- ......
Codeforces Round 898 Div

Educational Codeforces Round 155 (Rated for Div. 2)

Educational Codeforces Round 155 (Rated for Div. 2) A. Rigged! 解题思路: 若存在\(s[i] >= s[1]\)并且\(e[i] >= e[i]\),那么答案为\(-1\). 否则,答案为\(s[1]\). 代码: #include < ......
Educational Codeforces Round Rated 155

Educational Codeforces Round 155 (Rated for Div. 2)

比赛链接 A. Rigged! 题目链接 就是一个比较简单的模拟就可以解决,如何判断能不能第一只需要考虑比他力量大的耐力是不是也比他大就行,而只要比他大,他就不可能第一,否则输出他的力量作为标杆就行,这样也可以避免比他力量小的也可以举起来。 #include<bits/stdc++.h> using ......
Educational Codeforces Round Rated 155

Codeforces463-E.Team Work-组合数、DP

Codeforces463-E.Team Work 题意:求 \[\sum_{i=1}^n \binom{n}{i} i^k \]其中\(1\leq n\leq 10^9\),\(1\leq k \leq 5000\)。 题解: 其实这个题\(k\)的数据范围就已经暗示了做法的复杂度——应该是要去考 ......
Codeforces Team Work 463

她是 Codeforces 第四名,也是知名视频平台bilibili的“网红”

在2023年9月24日~9月25日举办的Educational Codeforces Round 155 (Rated for Div. 2)上,以优秀成绩拿下第四名仅学了ACM一年的Nanani,成为最夺目的选手之一。 而且虽然是仅学了一年的选手,但她取得优异成绩后,不少网友并不感到陌生,纷纷留言 ......
Codeforces bilibili 平台 视频

Codeforces Round 895 (Div. 3) 题解集

CF1872 题解集,包含 CF1872B The Corridor or There and Back Again,CF1872C Non-coprime Split,CF1872D Plus Minus Permutation。 ......
题解 Codeforces Round 895 Div

CodeForces 715E Complete the Permutations

洛谷传送门 CF 传送门 最小交换次数等于 \(n - \text{环数}\)。所以题目要我们统计把 \(p, q\) 补全成排列,连边 \(p_i \to q_i\),环数 \(= i\) 的方案数。 考虑把边根据 \(p_i, q_i\) 的是否已知状态分成四类: \(p \to q\) \(p ......
Permutations CodeForces Complete 715E 715

CodeForces 1062F Upgrading Cities

洛谷传送门 CF 传送门 考虑一个子问题:求从某个点 \(u\) 能到达的点数。 如果要精确地计算出来,最优解法只能是 \(O(\frac{n^2}{w})\) 的 bitset。但是我们还没有利用到题目的性质,我们只需要判断一个点是否至多有一个点互不可达。 考虑拓扑排序的过程,队列里面的点两两互不 ......
CodeForces Upgrading Cities 1062F 1062

加训日记 Day1——Codeforces Round 898(div4)低级失误

开始加训的第一天 ·cf AC了两道800题,一道1000的题目有思路,但是代码必然写的不如标答优美,一道1200思路有问题; ·atcoder写了道ABC的A,B的最长回文字符串突然忘记之前怎么写的了(bushi; ·898的div4场最后一场保护,E题出大锅,中间变量没用LL溢出了,结果赛后重测 ......
Codeforces 日记 Round Day1 div4

Codeforces 1868D. Flower-like Pseudotree

题目链接:D - Flower-like Pseudotree 题目大意:给定度数数组 \({d_n}\),要求构造一个 \(n\) 个点 \(n\) 条边的连通图(也就是基环树),允许有重边,但不能有自环。需要满足第 \(i\) 个点的度数恰好为 \(d_i\),并且将环上的边全部删去后,剩下的每 ......

CodeForces 1149D Abandoning Roads

洛谷传送门 CF 传送门 考虑一条 \(1 \to i\) 的路径是否在最小生成树上。 称边权为 \(a\) 的边为轻边,边权为 \(b\) 的边为重边。 轻边若不成环则一定在最小生成树上,因此先把轻边合并,这样形成了若干连通块。 那么如果两点在一个连通块,它们只能通过轻边互达。 同时,因为是树上路 ......
CodeForces Abandoning 1149D Roads 1149

Educational Codeforces Round 97 (Rated for Div 2) G. Death DBMS

Problem - G - Codeforces 题意 给定n个字符串,每个字符串有一个值val,n次询问,每次给一个字符串,询问给定n个字符串中是询问字符串子串的值的最大值 分析 多模式匹配,从中找到给定串的子串,想到建立ac自动机,对于给定字符串,在自动机上面匹配时,沿fail指针向上跳并求最大 ......
Educational Codeforces Death Round Rated

Codeforces Round 898 (Div. 4)(A-H)

Codeforces Round 898 (Div. 4) A.给abc的某个排列,问能否最多交换一次让排列变成abc 直接看有几个不在原位就行 查看代码 #include<iostream> using namespace std; void solve() { char a,b,c; cin>> ......
Codeforces Round 898 A-H Div

# [Codeforces Round 898 (Div. 4)] E. Building an Aquarium

Codeforces Round 898 (Div. 4) E. Building an Aquarium You love fish, that's why you have decided to build an aquarium. You have a piece of coral made ......
Codeforces Building Aquarium Round 898

Codeforces Round 898 (Div. 4)

Codeforces Round 898 (Div. 4) A Short Sort 直接枚举许所有情况即可 /* * * Author: north_h * Time: 2023-09-21 22:35:49 * * Problem: A. Short Sort * Contest: Codefo ......
Codeforces Round 898 Div

Codeforces Round 898 (Div. 4)

Codeforces Round 898 (Div. 4) A. Short Sort 解题思路: 遍历所有交换情况,看是否有\(abc\). 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; const ......
Codeforces Round 898 Div

Educational Codeforces Round 123 - D(思维题)

目录D. Cross Coloring D. Cross Coloring 题意 $n \times m $ 的方格纸上进行 q 次操作,每次操作选择某整行 x 和某整列 y,使得行 x 和列 y 均涂上 k 种颜色中的一种。问你最终的方案数 思路 代码 //>>>Qiansui #include< ......
Educational Codeforces 思维 Round 123

Educational Codeforces Round 154 (Rated for Div. 2) A-D

传送门:edu154/div2 A. Prime Deletion 题意:给定一个0-9的排列,要求一个长度>=2的子序列,使得该子序列是质数 做法:考虑31或者13即可。不过当时没有立刻想到,感觉1000以内的质数必有答案,打了暴力。用时就多了点。 Code #include<bits/stdc+ ......
Educational Codeforces Round Rated 154

CodeForces 1730F Almost Sorted

洛谷传送门 CF 传送门 过程相当于是将 \(p\) 重排列。设 \(b_i\) 为 \(p\) 中数为 \(i\) 的位置。考虑当前填的数 \(x\) 贡献的逆序对数,相当于是当前所有已经填入 \(p\) 的数 \(y\),都有 \([b_y > b_x]\) 的贡献。 考虑 \(p_{q_i} ......
CodeForces Almost Sorted 1730F 1730

Codeforces Round 753 (Div. 3) B. Odd Grasshopper

一维坐标轴上,蚱蜢一开始在 \(x_0\) 。在第 \(1\) 秒往后的每秒,第 \(i\) 秒蚱蜢可以跳 \(i\) 步。即若当时在 \(x\) ,可以跳到 \(x + i\) 或 \(x - i\) 。额外的,若 \(x\) 为偶数,蚱蜢会往左跳;否则会往右跳。 询问 \(n\) 秒后蚱蜢的坐标 ......
Grasshopper Codeforces Round 753 Div

CodeForces 889E Mod Mod Mod

洛谷传送门 CF 传送门 发现如果取模中途没有出现 \(0\),则可以 \(x \gets x + 1\)。 由此设 \(f_{i, j}\) 为考虑 \([1, i]\),最后取模得到的范围是 \([0, j]\)。 设最后的结果为 \(x\),中间结果减去 \(x\) 和为 \(y\),那么对答 ......
Mod CodeForces 889E 889