rounding maximum 1857b cf
[CF1849F] XOR Partition
# XOR Partition ## 题目描述 For a set of integers $ S $ , let's define its cost as the minimum value of $ x \oplus y $ among all pairs of different intege ......
Codeforces Round 888 (Div. 3)
## Codeforces Round 888 (Div. 3) ### T1 思路:直接模拟。 ### T2 思路:首先记录原始数组的奇偶性,然后将奇数、偶数分为不同两组进行排序,然后再根据原数组的奇偶性按顺序填入奇数偶数,最后判断整个数组是否非递减。 ### T3 思路:我们已知开始在 ......
Educational Codeforces Round 152 (Rated for Div. 2) 题解
$6$ 题做出来 $3$ 题,这一次的 D 题没能复刻上一次 Round 888 Div. 3 最后几分钟 AC 的奇迹 # A. Morning Sandwich 大水题,5min时间4min都在翻译题面 直接拿 $b$ 和 $c+h$ 进行比较分类讨论即可 单次操作时间复杂度 $O(1)$ # ......
CF858C 题解
[洛谷链接](https://www.luogu.com.cn/problem/CF858C)&[CF 链接](https://codeforces.com/problemset/problem/858/C) 本篇题解为此题**较简单做法**及**较少码量**,并且码风优良,请放心阅读。 ## 题目 ......
Educational Codeforces Round 152 (Rated for Div. 2)(A~D)
感觉代码越写越丑了...... 但能过题就是了 A. Morning Sandwich 莫诺卡普总是用美味的三明治开始他的早晨。莫诺卡普做的三明治总是由面包、奶酪和/或火腿组成。 三明治总是遵循以下公式 一块面包 一片奶酪或火腿 一块面包 …… 一片奶酪或火腿 一块面包 因此,面包总是放在顶部和底部 ......
LeetCode 239. Sliding Window Maximum 单调队列
You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. Yo ......
Educational Round 147
前言:非常好场次编号,爱来自小粉兔。 唉,GF。 A. shaber 模拟。 B. shaber。找最大的满足 $a_{l\sim r}$ 和 $a'_{l\sim r}$ 有不同,且 $a'_{l\sim r}$ 递增的 $\langle l,r \rangle$ 即可。$\mathcal O(n ......
CF613E Puzzle Lover 思考--zhengjun
题很简单,一遍写对却比较困难。 犯的错误: - 预处理 ${base}^i$ 时应该要处理到 $\max\{n,m\}$; - 去重的时候(reduce 函数)特判 $m=1,2$。 ### 代码 ```cpp #include using namespace std; using ll=long ......
Educational Codeforces Round 152 (Rated for Div. 2)记录
A. Morning Sandwich #include <cstdio> #include <algorithm> #include <cmath> #include <vector> #include <string.h> #include <set> #include <string> #in ......
SMU Summer 2023 Contest Round 7
# [SMU Summer 2023 Contest Round 7](https://codeforces.com/group/L9GOcnr1dm/contest/464081) ## [A. Two Rival Students](https://codeforces.com/group/L9 ......
重做 CF 295B Greg and Graph 以及理解 Floyd
# Floyd 原理简析 Floyd 的原理其实是 DP,定义 $\mathrm{dp}[S][i][j]$ 表示在仅经过点集 $S$ 里的点的条件下,从 $i$ 到 $j$ 的最短路距离 初始状态 $S$ 为空,$\mathrm{dp}[\varnothing ][i][j]$ 就等于 $i,j$ ......
Educational Codeforces Round 76 (Rated for Div. 2)
Educational Codeforces Round 76 (Rated for Div. 2) A - Two Rival Students 思路:最多可加x个距离,且最后的距离不能超过n-1 #include<bits/stdc++.h> using namespace std; #defi ......
Educational Codeforces Round 152 A~D
A #include <bits/stdc++.h> #define endl '\n' #define ios ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) using namespace std; typedef ......
CF1851 A-G
[link](https://codeforces.com/contest/1851) #### A 非常简单的比较大小问题 ```cpp #include #include #include #include #include #include #include #include #include ......
CF547D Mike and Fish 小丑做法--zhengjun
写到一半发现标签有二分图就不对劲了,题解区里都是欧拉回路。 然而我是随机化+模拟网络流!~~自豪~~ 首先可以先建模,观察同一种颜色,发现每一行或每一列的限制即为 $\lfloor\frac{t}{2}\rfloor\le x\le \lceil\frac{t}{2}\rceil$。 然后套路地把横 ......
Codeforces Round 888 (Div. 3) 题解
考场上 $7$ 题做出来 $4$ 题,最后几分钟才把 D 题调出来,但还是吃了不少罚时 # A. Escalator Conversations $O(n)$ 枚举即可,对于每个人计算需要的间隔台阶数是否在 $(0,m)$ 以内以及相差高度是否是 $k$ 的倍数 # B. Parity Sort 显 ......
Educational Codeforces Round 152 (Rated for Div. 2) C. Binary String Copying
# C. 二进制字符串复制 每次测试的时间限制2秒 每个测试的内存限制256兆字节 输入标准输入 输出标准输出 给你一个字符串s包含由...组成n个0或1。给出m次操作,让i-th 副本是字符串ti。然后,您对每个副本执行一次操作:i-th 副本,您对其子字符串进行排序[li,ri](子字符串来自原 ......
Educational Codeforces Round 76
# A. Two Rival Students 让两个人向两侧走就好了。 ```cpp #include using namespace std; void solve(){ int n , x , a , b; cin >> n >> x >> a >> b; if( a > b ) swap( ......
CF1188B 题解
[题目传送门](https://www.luogu.com.cn/problem/CF1188B) 感觉并不是特别难的题。 首先是一个简单的推式子,有原式: $$(a_i+a_j) \times ({a_i}^2+{a_j}^2) \equiv k \mod p$$ 如何针对 $a_i+a_j$ 进 ......
CF1635E Cars
题意:给定m对汽车之间的关系(无关紧要或命中注定·)。 1. 无关紧要:无论两辆汽车的速度是多少都不会相遇。 2. 命中注定:无论两辆汽车的速度是多少都一定会相遇。 对每辆车给出一个行驶方向和起点使得m个关系成立。 思路: 首先我们考虑无关紧要可以证明,如果两车同向,只要让较后的车速度更快一定会相遇 ......
CF709B 题解
[洛谷链接](https://www.luogu.com.cn/problem/CF709B)&[CF 链接](http://codeforces.com/problemset/problem/709/B) 本篇题解为此题**较简单做法**及**较少码量**,并且码风优良,请放心阅读。 ## 题目简 ......
Educational Codeforces Round 1
# Educational Codeforces Round 1 ## A. Tricky Sum ```cpp int fac[N],p2[N]; void init(){ fac[0]=1;p2[0]=1; for(int i=1;i0?"YES":"NO"); //puts(ans>0?"Ye ......
练习记录-cf-Educational Codeforces Round 152 (Rated for Div. 2)(A-D)
A. Morning Sandwich 题意:有面包片和火腿和芝士 问最多能组成几层三明治 题解:直接输出单考虑面包片和单考虑火腿和芝士的数量 取min #include<bits/stdc++.h> #define close std::ios::sync_with_stdio(false),ci ......
Codeforces Round 888 (Div. 3)记录
A. Escalator Conversations #include<cstdio> #include<algorithm> #include<cmath> #include<vector> #include<string.h> #include<set> #include<string> #in ......
CF623E Transforming Sequence
难点在于卡 `__int128`(?)。 首先 $N>K$ 显然无解,只需考虑 $N\le K$ 的情况。然而这并没有什么用。 把 $b$ 看作集合,显然 $b_i\subset b_{i+1}$。所以令 $f_{n,i}$ 为考虑到 $b_n$ 且 $|b_n|=i$ 的方案数,集合元素无序,即选 ......
Codeforces Round 618 (Div. 2)
# Codeforces Round 618 (Div. 2) https://codeforces.com/contest/1300 ## A. Non-zero 要求和,积都不为0,则先把全部0操作一次,然后再check 和是否为0,是的话再对任意数操作一次即可。 ```CC #include ......
CF938G Shortest Path Queries 题解
[TOC] # 题目链接 [CF938G](https://www.luogu.com.cn/problem/CF938G "CF938G") 洛谷挂了 只能交CF # 题目分析 本题有以下几个关键点: ## 为什么使用生成树建树 首先 根据 $WC2011$ 我们发现可以使用 $dfs$ 序来保存 ......
Codeforces Round 888 (Div. 3) A-F
## A. Escalator Conversations 题意:有一个扶梯,有n个人要站扶梯,这个扶梯有m个位置,第i个位置的高度为i*k,Vlad高H,第i个人高h[i],当且仅当两个人所处的位置高度加上自身身高刚好相同时才能谈话,问能和Vlad谈话的有多少人。 ### Solution 直接计 ......
CF309E解题报告
[题面](https://www.luogu.com.cn/problem/CF309E) ## 分析 求的是最大值最小,肯定容易想到二分,该题目的答案的单调性是存在的,因为如果你找到一组合法的解,可以将距离最大的两个区间的距离再增大,这样更大的答案一定是能得到的。 既然我们已经得到了二分的合理性, ......