Rated

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\) 个 ......
Educational Codeforces Beautiful Round Rated

Educational Codeforces Round 152 (Rated for Div. 2) B. Monsters

有 \(n\) 个怪物,第 \(i\) 个怪物的血量为 \(a_i\) 。英雄一次攻击可以造成 \(k\) 点伤害,但只会攻击当前生命值最高的怪物。若有多个最高血量的怪物,则选择编号最小的怪物攻击。当怪物的血量 \(\leq 0\) 时则被消灭。 输出一个排列,表示怪物被消灭的编号顺序。 容易想到, ......
Educational Codeforces Monsters Round Rated

Educational Codeforces Round 154 (Rated for Div. 2) B. Two Binary Strings

给定两个长度相等的 \(01\) 字符串 \(a\) 和 \(b\) 。每个字符串都是以 \(0\) 开始以 \(1\) 结束。 在一步操作中,你可以选择任意一个字符串: 选择任意两个位置 \(l, r\) 满足 \(s_l = s_r\) ,然后让 \(\forall i \in [l, r], ......
Educational Codeforces Strings Binary Round

Educational Codeforces Round 155 (Rated for Div. 2) B. Chips on the Board

给一个 \(n \times n\) 的棋盘,和两个大小为 \(n\) 的 \(a\) \(b\) 数组。\(a_i\) 代表第 \(i\) 列的权值,\(b_i\) 代表第 \(i\) 列的权值。坐标 \((i, j)\) 的权值为 \(a_i + b_j\) 。 现在需要放若干个芯片和到棋盘上, ......
Educational Codeforces Chips Board Round

Educational Codeforces Round 153 (Rated for Div. 2) A. Not a Substring

给一个长度为 \(n\) 的括号字符串 \(a\) 。你需要构造一个长度为 \(2n\) 的合法括号字符串 \(b\) ,且满足 \(a\) 不是 \(b\) 的子串。或者回答不可能。 显然若 \(a = ()\) ,则一定不可能构造出 \(b\) ,否则可以。 观察到合法括号穿串中, \(()() ......
Educational Codeforces Substring Round Rated

Educational Codeforces Round 87 (Rated for Div. 2) A. Alarm Clock

你总共需要睡满 \(a\) 分钟,第一个闹钟将会在第 \(b\) 分钟的时候响起。如果你醒来的时候睡眠不足,你会将脑子往后调 \(c\) 分钟,然后你需要 \(d\) 分钟的时间进入睡眠。假设第 \(0\) 分钟时你刚进入睡眠状态。 询问你最快能的起床时间,或者说明这是不可能的。 若 \(a \le ......
Educational Codeforces Alarm Clock Round

Educational Codeforces Round 90 (Rated for Div. 2) B. 01 Game

\(Alice\) 和 \(Bob\) 在玩一个 \(01\) 游戏,一开始有一个 \(01\) 串 \(s\) 。\(A\) 先开始,两人轮流操作。在每一步操作中,玩家可以选择 \(s\) 中两个相邻的不同数并且将他们删除。最后不能删数的玩家将失败。询问 \(Alice\) 是否可以获得胜利。 首 ......
Educational Codeforces Round Rated Game

Educational Codeforces Round 91 (Rated for Div. 2) A. Three Indices

给一个 \(n\) 个整数的排列 \(p_1, p_2, \cdots, p_n\) ,需要找到三个数 \(i, j, k\) 满足: \(1 \leq i < j < k \leq n\) \(p_i < p_j\) , \(p_j < p_k\) 否则回答不可能。 \(key\) :若存在上述 ......
Educational Codeforces Indices Round Rated

Educational Codeforces Round 116 (Rated for Div. 2) A. AB Balance

给一个长为 \(n\) 的字符串 \(s\) ,只包含 \(0\) \(1\) 两种字符。定义 \(AB(s)\) 是 \(s\) 中出现的 \(01\) 子串个数,\(BA(s)\) 是 \(s\) 中出现的 \(10\) 子串个数。 在一步操作中,可以选择一个字符进行异或。询问最小的操作次数使得 ......
Educational Codeforces Balance Round Rated

Educational Codeforces Round 96 (Rated for Div. 2) A. Number of Apartments

有三种建筑:三室厅、五室厅、七室厅。每个房间严格有一扇窗户。现在有 \(n\) 扇窗户,询问完全用完这些窗户的情况下,\(3, 5, 7\) 室厅各有多少间。输出任意一种答案,或者回答不可能。 假设一定有解,显然可以选择 \(mod\) 任意一个数贪心,不妨选最小的 \(3\) 。假设答案为 \(a ......

Educational Codeforces Round 156 (Rated for Div. 2) A-E

A题签到题 分余1 余2 余0讨论 #include<bits/stdc++.h> using namespace std ; #define maxn 400100 #define int long long int read(){ int ans = 0 , f = 1 ; char ch = ......
Educational Codeforces Round Rated 156

Educational Codeforces Round 105 (Rated for Div. 2) A. ABC String

给一个长为 \(n\) 的字符串 \(a\) ,\(n\) 是偶数,字符串中只包含三种字符 \(A, B, C\) 。规定一个合法的字符串为一个符合入栈规则的字符串。 需要构造一个长为 \(n\) 的括号字符串 \(b\) 。 \(b\) 是一个合法的括号序列 \(\forall 1 \leq i ......
Educational Codeforces String Round Rated

Educational Codeforces Round 156 (Rated for Div. 2) - A B C D

目录A. Sum of Three A. Sum of Three 如果说给定的数为 n 如果 \(n \le 6\) 或 \(n = 9\) 时,无法分解 如果 $n %% 3 != 0 $ 时,可以 ......
Educational Codeforces Round Rated 156

Educational Codeforces Round 156 (Rated for Div. 2)

Preface 沉迷Galgame不打CF懒狗闪总出列! 这场在大物课上口胡了前四个题,回去写了也都很顺,然后E题本来做不来的,看了眼昨天校队群里的消息就会做了 F题什么东西直接弃 A. Sum of Three 当\(n\bmod 3\ne 0\)时,用\((1,2,z)\)来凑;否则当\(n\b ......
Educational Codeforces Round Rated 156

April Fools Day Contest 2021 A. Is it rated - 2

询问若干个问题,每个问题用一段字符串表示,存在空格。每个问题一行,对于每个回答,只需要输出 \(NO\) 。 view1 #include <bits/stdc++.h> char s[1000005]; void solve(){ while (fgets(s, 1000005, stdin) ! ......
Contest April Fools rated 2021

Educational Codeforces Round 109 (Rated for Div. 2) B. Permutation Sort

给一个长为 \(n\) 的排列 \(a\),你可以执行以下操作:选择一个子数组并且按任意顺序重排,但这个子数组不能是数组本身。 询问最少经过多少次操作可以使得排列 \(a\) 变为升序。 定义操作次数为 \(ans\) 。 若数组已经有序,\(ans = 0\) 。 若 \(a_1 = 1\) 或者 ......

Educational Codeforces Round 110 (Rated for Div. 2) Array Reodering

给一个长为 \(n\) 的数组 \(a\) 。 定义一对 \(pair(i, j)\) 是 \(good\) 的当且仅当 \(1 \leq i < j \leq n\) 且 \(gcd(a_i, 2 \cdot a_j) > 1\) 。 如果你可以以任意顺序重排数组 \(a\) ,找到最多的 \(g ......
Educational Codeforces Reodering Array Round

Educational Codeforces Round 156 (Rated for Div. 2)

Educational Codeforces Round 156 (Rated for Div. 2) A. Sum of Three 解题思路: 如果\(n \leq 6 或 n =9\),无解。 若\(n \% 3 == 0,t = \lfloor\frac{3}{n}\rfloor\): 若\ ......
Educational Codeforces Round Rated 156

练习记录-cf-Educational Codeforces Round 156 (Rated for Div. 2)(A-C)

好久没打了 还是就出了三道 不过还好没掉分 A. Sum of Three 就是问能不能把一个数拆成三个不同的 且都不能被三整除的数 我的思路就是拆成1+2+一个大于等于4的数 如果拆了后另一个数是%3==0 那么我拆成1+4它肯定就不被整除 然后判下相同 #include<bits/stdc++. ......

Educational Codeforces Round 155 (Rated for Div. 2)

\(A. Rigged!\) 直接取第一个人能举起的最大重量看他是否是冠军即可。 void solve(){ int n=read(); int fx=read(),ft=read(); int ans=fx; for(int i=1;i<n;i++){ int x=read(),t=read(); ......
Educational Codeforces Round Rated 155

Educational Codeforces Round 112 (Rated for Div. 2) A. PizzaForces

有三种披萨:\(6\)、\(8\)、\(10\) 块披萨。制作时间分别需要:\(15\)、\(20\)、\(25\) 分钟。现在有 \(n\) 个人,每人需要一块披萨。询问使所有人能获得披萨的最快时间。 观察:发现三种披萨的性价比都一样。(否则按最优性价比贪心) 需要让得到的披萨数量 \(m \ge ......

Educational Codeforces Round 155 (Rated for Div

B. Chips on the Board 题解:贪心 显然我们可以把题意转化为:对于任意一个\((i,j)\),我们可以花费\(a_{i,j}\)的代价占据第\(i\)行和第\(j\)列,求占据所有格子的最小代价 考虑两种情况: 在每一行选一个格子 在每一列选一个格子 贪心选即可 int n, a ......
Educational Codeforces Round Rated 155

Educational Codeforces Round 122 (Rated for Div. 2)

A. Div. 7 #include<bits/stdc++.h> using namespace std; void solve(){ int n , a , b , c ; cin >> n; c = n % 10 , n /= 10; b = n % 10 , n /= 10; a = n % ......
Educational Codeforces Round Rated 122

Educational Codeforces Round 155 (Rated for Div. 2)

Preface 这天晚上这场因为不明原因(玩CCLCC中)就没有打,只能赛后补一下 这场的EF都不算难初看都有做法,但好家伙E写挂两发,F写个根号做法直接T到天上去了 A. Rigged! 签到题,对于所有的\(e_i\ge e_1\)的\(i\),求出\(S=\max s_i\),根据\(S+1\ ......
Educational Codeforces Round Rated 155

CF1197 Educational Codeforces Round 69 (Rated for Div. 2)

CF1197A DIY Wooden Ladder 答案为 \(\min(a_{n-1},n-2)\)。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=100005; ......
Educational Codeforces Round Rated 1197

CF1036 Educational Codeforces Round 50 (Rated for Div. 2)

CF1036A Function Height 答案为 \(\lceil \frac{k}{n}\rceil\)。 #include<iostream> #include<cstdio> using namespace std; long long n,k; int main() { scanf(" ......
Educational Codeforces Round Rated 1036

CF957 Codeforces Round 472 (rated, Div. 2, based on VK Cup 2018 Round 2)

CF957A Tritonic Iridescence 如果原序列中有两个相同的字符,显然不合法。 如果开头或者结尾为 ?,或者有两个连续的 ?,或者一个 ? 两边的字符不同显然合法。 否则一定不合法。 #include<iostream> #include<cstdio> using namesp ......
Round Codeforces rated based 2018

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

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