codeforces nonzero version 1753a

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

P6346 [CCO2017] 专业网络 & CF1251E1 Voting(Easy Version)

analysis 这个题目我们可以考虑用贪心来做。 我们不难看出来,这个题目是要让我们推出这么个结论:花小钱,办大人。 整体贪心的思路就出来了,然后就是实现部分。 因为我们认识的人随便是谁都可以。所以我们如果要买肯定是买最便宜的。这个性质可以用小根堆来维护。同时我们还可以维护我们可能结交的人数 \( ......
Version Voting 专业 P6346 1251E

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

【主席树】P8201 [传智杯 #4 决赛] [yLOI2021] 生活在树上(hard version)题解

P8201 简单题。 题中求的是 \(dis_{a, t} \oplus dis_{t, b} = k\) 是否存在,显然不好直接维护,考虑转化。 令 \(dist = dis_{a, t} \oplus dis_{t, b}\),\(val = \bigoplus\limits_{x\in \te ......
题解 主席 version P8201 8201

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

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/example/JobMain has been compiled by a more recent version of the Java Runtime (class file version 61.0), 问题的解决(未解决)

问题描述 使用hadoop在虚拟机里面运行打包的程序出错: 问题解决 真的服了,貌似是jdk的版本啥的问题,搜了好多,就是解决不了,求助求助啊! ......

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

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

nvidia-smi指令报错:Failed to initialize NVML: Driver/library version mismatch NVML library version: 535.113解决

nvidia-smi指令报错:Failed to initialize NVML: Driver/library version mismatch NVML library version: 535.113 我是刚开始没有nvidia-smi命令,输入后,提示我安装。 apt install nvi ......
library version NVML 指令 nvidia-smi

「题解」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

C++ namespace User_Unauthorized version 1.0.0 is officially released

Code namespace User_Unauthorized { /** * @brief This is a header file for competitive programming. * @author User-Unauthorized * @version 1.0.0 * @dat ......

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

Codeforces Round 901 (Div. 2)

目录写在前面ABCDE写在最后 写在前面 比赛地址:https://codeforces.com/contest/1875。 爱丽数码我真的好喜欢你啊为了你我要定制你的帆布包口牙!!!! A 显然只会在剩余时间为 1 时使用工具,模拟即可。 // /* By:Luckyblock */ #inclu ......
Codeforces Round 901 Div

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

A. Gift Carpet Problem 题目 Sol & Code 签到题 #include <bits/stdc++.h> #define N 21 typedef long long ll; int min(int a, int b) { return a < b ? a : b; } i ......
题解 Codeforces Round 894 Div