codeforces pumping 1909g lemma

Codeforces Round #885 (Div. 2)

赛时A题意理解错误,导致A调试半小时没出样例,直接提前下班-->https://codeforces.com/contest/1848 A. Jellyfish and Undertale 题意:初始时长为b的定时炸弹,没秒从n个工具中选一个加时长\(x_i\),每次加时不能超过a,并流失一秒。问: ......
Codeforces Round 885 Div

Codeforces 1765H 题解

题目大意 题目大意 给定一个 \(n\) 个点和 \(m\) 条边的有向图,并给定 \(p_1, p_2, \cdots, p_n\) 表示第 \(i\) 个点的拓扑序必须小于等于 \(p_i\),求出每个点的最小拓扑序。 题解 题解 题目要求拓扑序尽量小,转换一下就是在反图上拓扑序尽量大。考虑拓扑 ......
题解 Codeforces 1765H 1765

Codeforces Round 699 & 772题解

Codeforces Round 699 & 772题解 今天手感确实不错,看来合理的训练配合合理的休息是很重要的。前些日子的努力没白费。不过,怎么说呢,现在的形势不是我把算法题和基础知识做好的就行了,该从系统的角度去作为一个ld去思考问题了,感觉自己还是有点欠缺的,不过我也在积极努力的学习中,希望 ......
题解 Codeforces Round 699 772

Codeforces Round 901 (Div

C. Jellyfish and Green Apple 题解 显然\(n \% m =0\),答案一定为\(0\) 如果\(n > m\),我们显然可以将\(n / m\)的苹果分给每个人,然后再处理$n % m $ 如果\(n < m\),我们一定会将所有苹果一直对半切直到\(n > m\),所 ......
Codeforces Round 901 Div

Codeforces Round 895 (Div. 3)

A题简单的模拟计算,注意上取整的实现。 B题计算每个房间对应的每个最迟时间点,在这些时间点最取最小值,保证能安全通过所有房间。 D题拿到手就可以发现是贪心,但发现两部分会有冲突,也就是重复计算的部分。故提前找到两个数的lcm然后不计算lcm的倍数,为其他参与计算的数安排剩余数种的最大值和最小值,最后 ......
Codeforces Round 895 Div

Codeforces 1278D 题解

题目大意 题目大意 给你 \(n\) ( \(1\leqslant n\leqslant 5\cdot 10^5\) ) 条线段 \([l_1, r_1], [l_2, r_2], \cdots, [l_n, r_n]\) ( \(1\le l_i < r_i\le 2n\) )。保证每条线段的端点 ......
题解 Codeforces 1278D 1278

Codeforces Round 811 (Div. 3)

A. Everyone Loves to Sleep #include<bits/stdc++.h> using namespace std; void solve() { int n, h, m, t; cin >> n >> h >> m; t = h * 60 + m; vector<int> ......
Codeforces Round 811 Div

Codeforces 1702G2 题解

题目大意 给出一个大小为 \(n\) 的树,\(q\) 次询问,每次给出一个大小为 \(m\) 的点集,判断是否有一条链覆盖这些点(这条链可以经过其他点)。 \(n,\sum m\leqslant 2\cdot 10^5\) , \(q\leqslant 10^5\)。 提示 提示 1 思考将 $m ......
题解 Codeforces 1702G2 1702G 1702

CodeForces 1874B Jellyfish and Math

洛谷传送门 CF 传送门 看到这种操作乱七八糟不能直接算的题,可以考虑最短路。 对于 \(a, b, c, d, m\) 按位考虑,发现相同的 \((a, b, m)\) 无论如何操作必然还是相同的。 于是考虑对于每个可能的 \((0/1, 0/1, 0/1)\),所有终态有 \((c = 0/1, ......
CodeForces Jellyfish 1874B 1874 Math

「题解」Codeforces Round 895 (Div. 3)

A. Two Vessels Problem 题目 Sol & Code 签到题 #include <bits/stdc++.h> typedef long long ll; int min(int a, int b) { return a < b ? a : b; } int max(int a, ......
题解 Codeforces Round 895 Div

Codeforces Round 901 (Div. 2)

Codeforces Round 901 (Div. 2) A - Jellyfish and Undertale 解题思路: 卡在最后秒放。 若\(x_i > (a - 1)\):那么该\(x_i\)的贡献为\(a - 1\)。 否则,该\(x_i\)的贡献为\(x_i\)。 代码: #inclu ......
Codeforces Round 901 Div

Codeforces Round 653 (Div. 3)

A*800: 给定 x,y,n。 找出k%x==y && k<=n。 让 t=(n-y)/x, 答案就是t*x+y B*900: 如果说n有除了2,3以外的质数,答案就是-1 让c2=2出了多少次, c3情况相同 如果c2>c3,答案也是-1因为不可能移除掉那些2 其他情况:答案就是c3+(c3-c ......
Codeforces Round 653 Div

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

Codeforces Round 898 (Div. 4)

由于题目补完才来写总结,导致前面的有的题目都需要重新再看一遍,只好当作复习了。 但考虑到趁热打铁,先看H. H题:从小白视角来看乍一看是博弈论,仔细思考以后发现是图论。本题给的是基环树,意识到这一点很重要,这个条件是让本题不是很复杂的关键。n个点n条边且没有重边保证这个联通图中只有一个环。由于瓦能够 ......
Codeforces Round 898 Div

Codeforces Round 900 (Div. 3)

目录写在前面ABCDEFG写在最后 写在前面 比赛地址:https://codeforces.com/contest/1878。 前天晚上他妈睡不着觉又不想看漫画打游戏于是到阳台上开把 div3 放松心情。 40min 过了 5 题把剩下两题都口了感觉没意思了于是睡觉。 太菜了还是,现在是 div3 ......
Codeforces Round 900 Div

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

Charge Pump

https://juejin.cn/post/7242717749906161720 Charge Pump 倍压输出的工作原理 Charge Pump(电荷泵)最经典的应用莫过于倍压输出,其基本原理简而言之就是对电容进行充放电,利用电容能够储存电荷的原理将其从充电回路隔离,通过放电回路对输出进行放 ......
Charge Pump

Codeforces Round 627 (Div. 3)

Codeforces Round 627 (Div. 3) A. Yet Another Tetris Problem 解题思路: 最终所有位置减去的数是相同的,也就是说能否通过\(+2\)的方式使所有数相同。 即如果存在两个数之间的差为奇数,那么就不可能同时为\(0\)。 代码: #include ......
Codeforces Round 627 Div

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

Codeforces Round 695 (Div. 2)

练习笔记: A:https://codeforces.com/contest/1467/problem/A 一开始以为是 987654321..... 交了两发WA。慢慢想想就是如果说我是第二个号码放8就是98901234.... 交了就是AC B: https://codeforces.com/c ......
Codeforces Round 695 Div

加训日记 Day5——codeforces round 899 再战div2

Day5,9.25,codeforces round 899 div2 ·事实证明自己的思维和手速都还不够快,晚上还晚来了一点 ·B题属实是,上来就想着并查集(菜鸡是这样的)然后发现不会写捏 ·思考了很久(看数据量)感觉是枚举暴力,但是又想不到怎么去枚举 ·一题遗憾离场 ·顺理成章的-26 ......
codeforces 日记 round Day5 div2

Problem - 616C - Codeforces

Problem - 616C - Codeforces C. The Labyrinth 如果是直接对\(*\)去跑dfs或者bfs的话无疑是会超时的 既然如此,那我们可以去对 \(.\) 跑搜索,将各个连通的 \(.\) 块标号并计算出连通块内的点的数量,然后去遍历\(*\)的时候只需要上下左右跑 ......
Codeforces Problem 616C 616

Codeforces Round 900 (Div. 3)

Codeforces Round 900 (Div. 3) A. How Much Does Daytona Cost? 解题思路: 可取一个元素作为子数组,数组中存在\(k\)即可。 代码: #include<bits/stdc++.h> using namespace std; using ll ......
Codeforces Round 900 Div

CF1195 Codeforces Round 574 (Div. 2)

CF1195A Drinks Choosing 先将相同权值的配对直到只剩下一个,然后再配剩下的单个。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int n,k; int a[N]; int ......
Codeforces Round 1195 574 Div

CF1440 Codeforces Round 684 (Div. 2)

CF1440A Buy the String 每个点有两种决策,要么选当前的字符,要么选跟当前字符不同的字符,取个较小值相加。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int T; int ......
Codeforces Round 1440 684 Div

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

CF1447 Codeforces Round 683 (Div. 2, by Meet IT)

CF1447A Add Candies 可以将操作看做将 \(a_i\) 减 \(i\),然后第 \(i\) 次操作 \(i\) 就是合法的。 #include<iostream> #include<cstdio> using namespace std; int T; int n; void so ......
Codeforces Round 1447 Meet 683

CF1008 Codeforces Round 497 (Div. 2)

CF1008A Romaji 直接模拟。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=105; int n; char s[N]; int main() { scanf( ......
Codeforces Round 1008 497 Div

CF1011 Codeforces Round 499 (Div. 2)

CF1011A Stages 每次记下上一个选的位置,贪心能填就填。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n,k; char s[N]; int cnt[27]; int main( ......
Codeforces Round 1011 499 Div

CF1020 Codeforces Round 503 (by SIS, Div. 2)

CF1020A New Building for SIS 分类讨论 \(a,b\) 两个端点的几种情况就好了,特判 \(t_a=t_b\) 的情况。 #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> usi ......
Codeforces Round 1020 503 Div