codeforces b_div 1100 1905

Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final

Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final A. Goals of Victory 解题思路: 答案为所有元素之和的负数。 代码: #include <bits/stdc++.h> using namespace std; u ......
Codeforces COMPFEST Round Final based

【题解】CodeForces-1876/1877

CodeForces-1877A Goals of Victory 答案是 \(-\sum_{i=1}^{n-1} a_i\)。 提交记录:Submission - CodeForces CodeForces-1876A Helmets in Night Light 按 \(b_i\) 排序,贪心取 ......
题解 CodeForces 1876 1877

Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final Round)

Preface 难得这么好时间的CF,我直接找来队友组队练题 当然比赛的过程没有三人三机,就跟平时训练一样搞了个新号三人一机的写 中间因为溜去先看F了导致E题留给徐神solo因此出的偏慢,不过后面一起讨论了一下还是出了 最后开F结果好家伙我和祁神双双看错题,对着假题意苦战1h最后无奈投降,今天去再看 ......
Round Codeforces COMPFEST Final based

Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final Round)

比赛连接 打着打着吃饭去了,又掉分了! A. Goals of Victory 题意: 一场比赛有n个球队,每一个队伍匹配一次,球队的效率等于球队的得分数减去对手的得分数,给出n-1个数据,让你求出未给出的那个数据。 思路: 所有球队的效率和为0 代码: #include<bits/stdc++.h ......
Round Codeforces COMPFEST Final based

CodeForces 1876D Lexichromatography

洛谷传送门 CF 传送门 这说明你的能力还不足以维持 IM。 显然 balanced 的充要条件是,对于每个值,染色一定是 RB 交替。然后一种值只会有先染红或先染蓝两种情况。 然后还剩下字典序严格小于的条件。我场上的想法是枚举 \(\text{LCP}\),然后推出来一个巨大麻烦做法,根本写不出来 ......
Lexichromatography CodeForces 1876D 1876

Codeforces Round 730 (Div. 2) A. Exciting Bets

给两个正整数 \(a, b\) ,可以执行以下操作之一任意次: \(a = a + 1, b = b + 1\) 。 \(a = a - 1, b = b - 1\) 。 需要保证 \(min(a, b) \geq 0\) 。 询问 \(gcd(a, b)\) 最大是多少,且到达最大 \(gcd(a ......
Codeforces Exciting Round Bets 730

Codeforces Round 902 (Div. 1, based on COMPFEST 15 - Final Round) A~D

A. Helmets in Night Light 首先注意到一个关键性质 \(b_i \geq 1\),这就意味着当我们花 \(p\) 的代价解锁了 \(b_i\) 最小的后,仅凭接下来的“连锁反应”就能解锁全部的点。注意到我们“连锁反应”的一定是按 \(b_i\) 从小到大排序后的一段前缀(因为 ......
Round Codeforces COMPFEST Final based

Codeforces Round 902 (Div. 2) (CF1877) B、C、D 题解

B 题目大意 你要传话给 \(n\) 个人,每传一下话需要花费 \(p\) ,当一个人被传话后,他可以最多传给 \(a_i\) 个人,每次花费 \(b_i\) 。问把话传给 \(n\) 个人的最小花费。 分析 首先传给第一个人只少要 \(p\) 下来贪心,每次让花费最小、且能够传话的人去传话。 考虑 ......
题解 Codeforces Round 1877 902

Codeforces Round 902 Div. 2 - A B C D

目录A. Goals of VictoryB. Helmets in Night Light 传送门 A. Goals of Victory 对给定 n - 1 组队伍的净得分求和取负即为最后一组队伍的净得分 B. Helmets in Night Light 赛时想法假了,赛后更正 对所有人按照传 ......
Codeforces Round 902 Div

Codeforces Round #902 (Div.1)

A 注意到 \(a_i\ge 1\),因此我们先花 \(p\) 的代价买下 \(b\) 最小的,然后一定可以一直用当前可能的最小代价买下后续的人。不难发现这一定是最优的方案。 只需要将序列排序或者用 std::multiset 来维护。单组数据时间复杂度 \(O(n\log n)\)。 https: ......
Codeforces Round 902 Div

【题解】CodeForces-1874/1875

CodeForces-1875A Jellyfish and Undertale 一定是等待降到 \(1\) 或者能补满到 \(a\) 时才使用工具,依题意模拟即可。 提交记录:Submission - CodeForces CodeForces-1874A Jellyfish and Game 这 ......
题解 CodeForces 1874 1875

Codeforces Round 901 (Div. 2) D. Jellyfish and Mex (DP)

Codeforces Round 901 (Div. 2) D. Jellyfish and Mex //思路:对于大于mex的数不做处理,把0删完为结束 //dp[j]为mex更新到j所需要的最小花费 //用mex=i时更新到j,转移方程为 dp[j] = min(dp[j], dp[i] + i ......
Codeforces Jellyfish Round 901 Div

Codeforces Round 900 (Div. 3) E. Iva & Pav (位运算)

Codeforces Round 900 (Div. 3) E. Iva & Pav //思路:10^9转换为2^32上的位,进行位运算,a[x][i]为到x为止第i位的1个数前缀和 //对于与运算,如果当前i的前缀和不为 r-l+1 ,则这一位的与运算结果为0 //当找到从左往右第一个位置i为1 ......
Codeforces Round 900 Div Iva

Codeforces Round 901 (Div. 2) C. Jellyfish and Green Apple (位运算)

Codeforces Round 901 (Div. 2) C. Jellyfish and Green Apple //思路:浮点数转二进制,a/b的结果为 gcd(a,b)*最简分式(n/m)的结果 //苹果能分的前提是人数得是一个2的次幂数,通过切割只能分为形同0.001的二进制小数 //a/ ......
Codeforces Jellyfish Apple Round Green

Codeforces Global Round 3

C题就是考虑利用1,n两个端点就好,有些细节要特判。 #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #define A puts("Yes") #define B puts ......
Codeforces Global Round

Codeforces Global Round 2

C题结论就是每行每列不同的个数必须是偶数。 D题首先注意到对于长度相同的询问,答案都是一样的。 同时相同的s可以直接丢掉。 那么我们将s排序之后,将相邻的差再进行排序,然后将询问从小到大处理。 相当于是将这些段拼接在一起。 #include<cstdio> #include<algorithm> # ......
Codeforces Global Round

【计算几何】codeforces上面的一点简简单单的计算几何入门题

开篇碎碎念 我真的好喜欢开篇碎碎念啊(可恶真的是太话痨啦)最近有在cf上面写写题,唔不过还没上百题,过两天就可以写百题纪念啦,也还没上青,陌陌菜菜,陌陌在努力变强捏。 cf1850G The Morning Star tag: 用map进行维护,斜率与坐标的关系 题目链接:G. The Mornin ......
几何 codeforces 面的

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

A. Escalator Conversations Problem [题目](Rudolph and Cut the Rope) Sol & Code 绳子长度大于钉子高度的要剪 #include <bits/stdc++.h> typedef long long ll; int min(int ......
题解 Codeforces Round 883 Div

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

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

10.5 Codeforces Round 638 (Div. 2)

Codeforces Round 638 (Div. 2) A - Phoenix and Balance 思路:加的数成等比关系,且第n项大于前n-1项的和,那么最大的一项加上最小的几个即可 #include<bits/stdc++.h> using namespace std; #define ......
Codeforces Round 10.5 638 Div

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

A. Array Coloring Problem 题目 Sol & Code 只有数列的和为偶数时才符合要求,即有任意个偶数,偶数个奇数。 将这些数分成两部分,发现两部分初始值 \(0\) 为偶数,偶数不会影响奇偶性,故需要偶数个奇数。 #include <bits/stdc++.h> #defi ......
题解 Codeforces Round 891 Div

CodeForces 814E An unavoidable detour for home 题解

更好的阅读体验 题意 题目链接 (洛谷翻译) 给出 \(n\) 个点,和每个点的度 \(d_i\) 让你构造出一张无向图满足以下两条性质: 点 \(1\) 到点 \(i\) 仅有 唯一 一条最短路。 点 \(1\) 到点 \(i\) 的最短路长度大于等于点 \(1\) 到点 \(i-1\) 的最短路 ......
题解 unavoidable CodeForces detour 814E

Codeforces Round 901 (Div. 2) - A B

目录A. Jellyfish and UndertaleB. Jellyfish and Game 题目传送门 A. Jellyfish and Undertale 贪心考虑每次时间减到 1 时能否使用工具加时间,注意总时间上限是 a B. Jellyfish and Game 贪心考虑美每位选手肯 ......
Codeforces Round 901 Div

CodeForces 1864H Asterism Stream

洛谷传送门 CF 传送门 好题。 考虑计算 \(x\) 落在 \([1, n - 1]\) 的概率。设 \(f_i\) 为 \(x\) 经过 \(i\) 的概率,答案即为 \(\sum\limits_{i = 1}^{n - 1} f_i\)。 \(f\) 有一个朴素的递推: \[f_i = \be ......
CodeForces Asterism Stream 1864H 1864

Codeforces Round 888 (Div. 3)DEF

Codeforces Round 888 (Div. 3)DEF D. Prefix Permutation Sums 题意:给你一个长度为 \(n - 1\) 的数组,是否能找出一个长度为 \(n\) 的排列,求出这个排列的前缀和,去掉前缀和数组的任意一个元素之后和原来的数组相等。 例如 \([6 ......
Codeforces Round 888 Div DEF

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

Codeforces 449E - Jzzhu and Squares

显然任意一个顶点是关键点的正方形都可以用两个量来刻画:以其任意一条边对应的直角边平行于坐标轴的直角三角形的两直角边的长度 \(i,j\)(在下文中记这样的正方形为正方形 \((i,j)\))。对于 \(i+j\) 相同的两种正方形,显然一个 \(n\times m\) 的点阵中这样的两正方形个数是相 ......
Codeforces Squares Jzzhu 449E 449

Codeforces 1874F - Jellyfish and OEIS

考虑对 \(\sum m_i-i+1\) 个不可行的集合进行容斥,即钦定一些区间集,要求它们对应的 \(p_l,p_{l+1},\cdots,p_r\) 必须是 \([l,r]\) 的排列,计算方案数乘以容斥系数之和。 如果容斥的集合中存在相交的区间,那么这个方案数其实不太好计算。不过根据区间的性质 ......
Codeforces Jellyfish 1874F 1874 OEIS

Codeforces Round 898 (Div. 4) A~H

Codeforces Round 898 (Div. 4) A~H A. Short Sort 题意:输出不一样的字符的个数 思路:模拟即可 // AC one more times // nndbk #include <bits/stdc++.h> using namespace std; typ ......
Codeforces Round 898 Div

Codeforces Round 901 (Div. 2)

Preface 摆烂人闪总出列,开个小号摆烂打Div2,龟速1h写完前四题后发现后面三个题过的人数是1/2/1 遂假装挣扎了下看了下EF题面,发现F很可做就开始推式子,后面一看妈的样例都过不去才发现题目看错了 还好拿的新号打的,遂直接无限活力,启动! 后面看了下F原来比我想的还简单来着,E的做法确实 ......
Codeforces Round 901 Div