codeforces round div2 915

Codeforces Round 897 (Div. 2)

F. Most Different Tree 当 \(n=2\) 时,只能构造一条长度为 \(2\) 的链。 当 \(n\ge 3\) 时,对于 \(i\) \((1\le i\le n)\),以 \(i\) 作为根的树记为 \(h_i\),考虑枚举树找一个大小为 \(s\) 的树 \(t\),使得 ......
Codeforces Round 897 Div

Codeforces Round 897 (Div. 2)

Codeforces Round 897 (Div. 2) A. green_gold_dog, array and permutation 分析: 由题意: \[c_i = a_i - b_i \]\(c_i\)种类最多就是\(n\)个数都不同。 若\(a_i\)不断变大,\(b_i\)不断变小, ......
Codeforces Round 897 Div

atcode abc318,codeforce 1861

题目链接 题解 目录AtCoder abc318_a Full MoonAtCoder abc318_b Overlapping sheetsAtCoder abc318_c Blue SpringAtCoder abc318_d General Weighted Max MatchingAtCod ......
codeforce atcode 1861 abc 318

Codeforces Round 897 (Div. 2) A~E

Codeforces Round 897 (Div. 2) A~E A: 原先数组里面最小的位置放最大的数,次小的放次大的即可。 void solve(){ int n; cin>>n; for(int i=1;i<=n;i++){ int x; cin>>x; c[i]={x,i}; } sort ......
Codeforces Round 897 Div

Codeforces Round 896 (Div. 2)

Codeforces Round 896 (Div. 2) A. Make It Zero 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using i128 = __int128; int n, m; ......
Codeforces Round 896 Div

C#中Math.Round(指定四舍五入)、Math.Ceiling和Math.Floor的用法

1.Math.Round:四舍六入五取偶 Math.Round(17.475728155339805, 2, MidpointRounding.AwayFromZero)=17.48 Math.Round(0.0) //0Math.Round(0.1) //0Math.Round(0.2) //0M ......
Math Ceiling Floor Round

[2022 China Collegiate Programming Contest (CCPC) Guilin Site](https://codeforces.com/gym/104008) CEM

2022 China Collegiate Programming Contest (CCPC) Guilin Site CEM C. Array Concatenation 思路:数学推柿子 考虑有两种操作: 复制 \(b' = \{b_1,b_2,...,b_{|b|},b_1,b_2,..., ......

$Codeforces Round 897 (Div. 2)$

\(A. green_gold_dog, array and permutation\) 让大的数减小的数就可以制造更多的不同。 PII a[N]; int ans[N]; void solve(){ int n=read(); for(int i=1;i<=n;i++){ a[i]=make_pa ......
Codeforces Round 897 Div

CQBZ Round 12

首先,在本次考试中,我深刻认识到了常数优化的重要性。 我决心改掉 #define int long long 的坏习惯。 我们不能保证评测机的速度,我们只能保证自己代码的优秀。` 同时我要下定决心更改自己的思维方式。 我发现自身在做题时应合理利用时间,创造价值,不能出现T6这种写2.5h没拿一分的情 ......
Round CQBZ 12

CodeForces 542B Duck Hunt

洛谷传送门 CF 传送门 首先转化一下,让鸭子不动,猎人往右移动,就相当于开的相邻两枪距离 \(> m\)。 设 \(f_{x, i}\) 为仅考虑 \(r \le x\) 的鸭子,上一次在 \(i\) 开枪,能打到的最大鸭子个数。 \(f_{x - 1} \to f_x\) 时,首先有 \(f_{ ......
CodeForces 542B Duck Hunt 542

Codeforces Round 896 (Div. 1)

Preface 不管怎么说,最后还是被我苟上橙名了(虽然刚好2100整,不多不少) 感觉我在1900~2100之间卡了好久好久,反观我的队友都是打上紫名后随便两三场就打上橙了,狠狠地羞辱我这个铁混子 由于暑假集训打的校内排名比较高,作为新队伍也拿到了今年的一场CCPC+一场ICPC的名额,虽然要自费 ......
Codeforces Round 896 Div

SICTF-2023 round2

前言 又是挺长一段时间没有打ctf了,各种原因,要过一段时间才会继续上强度学安全吧QAQ。这个SICTF是被朋友拉过来打的,看了一下,还是挺有意思的。下面记录下题目,以及复习到的一些知识点吧。笔者真的是脑子不好使了 签到Shop 很简单的签到题目,算是一个整型溢出的类型。 Different_gad ......
round2 SICTF round 2023

Codeforces Round 101 (Div. 2) C - E

C. Queue (思维、排序、构造、*1800) 题意:$ n $ 个人排队, 为他们构造一组身高, 使得 $ x $ 的前面有 $ a_i $ 个人比他高。如果无法构造满足所有条件的身高序列, 输出 -1。 思路:首先考虑, 对于 $ a_i $ 较大的人, 肯定尽可能地将其往队伍后面放, 然后 ......
Codeforces Round 101 Div

Codeforces Round 896 (Div. 2) A-D2

A. Make It Zero 没看懂这个 8 次的限制是什么意思。先用一次直接把所有数变成 \(\oplus_{i=1}^n a_i\),如果 \(n\) 是偶数直接 \([1,n]\) 做完,如果是奇数先把 \([1,n-1]\) 变成 0,再做两遍 \([n-1,n]\) 即可。 点击查看代码 ......
Codeforces Round 896 A-D Div

【题解】Educational Codeforces Round 142(CF1792)

没有手速,再加上被 E 卡了,废掉了。 A.GamingForces 题目描述: Monocarp 正在玩电脑游戏。他打算杀死 \(n\) 个怪兽,第 \(i\) 个的血量为 \(h_i\)。 Monocarp 的角色有两个魔法咒语如下,都可以以任意顺序用任意次(可以不用),每次使用相当于一次操作。 ......
题解 Educational Codeforces Round 1792

Codeforces Round 895 (Div. 3)

Codeforces Round 895 (Div. 3) A - Two Vessels 思路:找到差值,让a,b向中间靠 #include<bits/stdc++.h> using namespace std; #define int long long //#define int __int1 ......
Codeforces Round 895 Div

SMU Autumn 2023 Round 2(Div.1+2)

SMU Autumn 2023 Round 2(Div.1+2) C. Chaotic Construction 把环展开的话就是\(1 \sim 2n\),若\(D\)的位置放上路障的话,在这个展开的环上就是\(D\)和\(D+n\)的位置,对于\(x,y\),我们就是去看\(D\)或者\(D+n ......
Autumn Round 2023 SMU Div

Codeforces Round 798 (Div. 2) B. Mystic Permutation

给一个长为 \(n\) 的排列 \(p\) ,需要构造一个长为 \(n\) 的排列 \(q\) ,满足 \(\forall i, p_i \neq q_i\) ,且 \(q\) 在所有合法排列中字典序最小。 观察一:\(n = 1\) 时无解,否则有解。 观察二:\(n > 1\) 时,\(1 \s ......
Permutation Codeforces Mystic Round 798

Codeforces Global Round 21 B. NIT Destroys the Universe

给一个长为 \(n\) 的数组,可以执行以下操作任意次: 选择 \(l, r(1 \leq l < r \leq n)\) ,让 \(\forall i(l \leq i \leq r), a_i = mex(\{a_l, a_{l+1}, \cdots, a_{r}\})\) 。 问最小操作数使得 ......
Codeforces Destroys Universe Global Round

SICTF-2023 #Round2-WP-Crypto | Misc

💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌 ......
Round2-WP-Crypto Crypto Round2 SICTF Round

Educational Codeforces Round 132 (Rated for Div. 2) B. Also Try Minecraft

一个世界地图用一个长为 \(n\) 的数组表示,\(a_i\) 代表坐标 \(i\) 的高度。若下一块区域的高度为 \(y\) ,当前区域的高度为 \(x\) ,则一次行走会受到 \(max(y - x, 0)\) 点下落伤害。 有 \(q\) 个询问,每个询问独立,给定起点和终点坐标 \(s, t ......
Educational Codeforces Minecraft Round Rated

Educational Codeforces Round 130 (Rated for Div. 2) B. Promo

有 \(n\) 件商品,第 \(i\) 件的价格是 \(p_i\) ,若买至少 \(x\) 件商品,则其中最便宜的 \(y\) 件免费。给 \(q\) 个询问,每次给出 \(x, y\) ,回答最多能免费的价值。 按大到小排序,求前缀和 \(S_{i}\) 表示买前 \(i\) 件商品需要的开销。 ......
Educational Codeforces Round Rated Promo

Codeforces Round 895 (Div. 3)

A. Two Vessels #include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; using i64 = long long; void solve() { int ......
Codeforces Round 895 Div

Codeforces Round 804 (Div. 2) B. Almost Ternary Matrix

给两个偶数 \(n\) 和 \(m\) 。任务是构造任意一个二进制矩阵,\(n \times m\) 。对于任意 \((i, j)\) ,有且仅有两个邻居的颜色与 \(a_{i, j}\) 不同。邻居的定义为 \(|x - x'| + |y - y'| = 1\) 。 观察:任何 \(n \time ......
Codeforces Ternary Almost Matrix Round

Codeforces Round 807 (Div. 2) B. Mark the Dust Sweeper

需要打扫 \(n\) 个房间,第 \(i\) 个房间有 \(a_i\) 的积灰。只能使用如下魔法打扫: 选择 \(i, j, (1 \leq i < j \leq n, \min_{k = i}^{j} a_i > 0)\) 。 执行 \(a_i = a_i - 1, a_j = a_j + 1\) ......
Codeforces Sweeper Round Mark Dust

Codeforces Round 811 (Div. 3) A. Everyone Loves to Sleep

闹钟设有 \(n\) 个时间点,第 \(i\) 个时间为 \((H_i,M_i)\) 。在 \(h, m\) 时刻入睡,响铃必须起床,问能睡多久。 使用 \(set<pair<int, int>>\) 存储闹铃时刻,然后在其中 \(lower_{bound}\) 到 \(<first \geq h, ......
Codeforces Everyone Round Loves Sleep

Codeforces Round 815 (Div. 2) A. Burenka Plays with Fractions

给两个数 \(\frac{a}{b}\) 和 \(\frac{c}{d}\) ,一次修改可以修改 \(a\) 或 \(b\) 之一,求最小修改数使得 \(\frac{a}{b} = \frac{c}{d}\) 。 若 \(\frac{a}{b} = \frac{c}{d}\) ,除式化乘式,则讨论 ......
Codeforces Fractions Burenka Round Plays

Codeforces Round 819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022 A. Mainak and Array

给一个长为 \(n\) 的正整数数组,执行以下操作严格一次。 选择 \(l, r, (1 \leq l < r \leq n)\) ,任意一个正整数 \(k\) 。 重复 \(k\) 次:让 \([l, r]\) 的数组成环,按顺时针走一次。 希望 \(a_n - a_1\) 最大,找到这个数。 分 ......
Codeforces Div and Grimoire Contest

SICTF2023 #Round 2 wp

Reverse [签到]PYC 电脑上的pycdc出问题了,就找个在线的 https://www.lddgo.net/string/pyc-compile-decompile print('SICTF{07e278e7-9d66-4d90-88fc-8bd61e490616}') Myobject ......
SICTF Round 2023 wp

Codeforces Round 830 (Div. 2) B. Ugu

给一个 \(01\) 字符串,需要使它变为非降的,可以执行以下操作: 选择一个下标 \(i, (1 \leq i \leq n)\) ,\(\forall j \geq i\) 的数位翻转。 经典的按无后效性翻转问题。 考虑从前往后,得到一个全 \(0\) 串。若开始存在 \(1\) ,则答案减 \ ......
Codeforces Round 830 Div Ugu