educational codeforces round 156

[补题] Codeforces Round 891 (Div. 3)

### 闲话 第一场CF div3,T2读错题了...T3构造乱搞没搞出来...在此深刻反思。 ### A #### Translate 我们可以任意将一个数组拆成两部分,分别求出这两部分的和,是否有一种拆分方式使得这两部分和的奇偶性相同? #### Analysis ~~根据小学数学我们得知~~ ......
Codeforces Round 891 Div

Codeforces Round 891 (Div. 3)

# [Codeforces Round 881 (Div. 3)](https://codeforces.com/contest/1857) ## [A.Array Coloring](https://www.luogu.com.cn/problem/CF1857A) ### 题目大意 [link] ......
Codeforces Round 891 Div

CodeForces CF1846G 题解

# CodeForces CF1846G 题解 - [CodeForces题目链接](https://codeforces.com/contest/1846/problem/G) - [洛谷题目链接](https://www.luogu.com.cn/problem/CF1846G) - 标准答案是 ......
题解 CodeForces 1846G 1846 CF

Codeforces Round 891 (Div. 3)

Codeforces Round 891 (Div. 3) A - Array Coloring 思路:需要两部分的奇偶相同,判断奇数的个数是否为偶数即可 #include<bits/stdc++.h> using namespace std; #define int long long //#de ......
Codeforces Round 891 Div

Codeforces 890-891的一些题目的反思

和atcoder一起出交互题是吧。 D题回复逆序对个数,对于[L,R-1]和[L,R],如果R是最大值,那么对逆序对个数无影响。这样来确认某个数是不是最大的,然后递归扩展到整个区间 这里看到逆序对,要想到归并排序、分治、递归、区间合并。。。。。 查看代码 // Problem: D. More Wr ......
Codeforces 题目 890 891

codeforces 891 (div3)857E - Power of Points

# E. 点的力量 每个测试限时2秒 每个测试限制内存为256兆字节 输入以标准格式输入 输出以标准格式输出 给定n个具有整数坐标x1,…xn的点,这些点位于数线上。对于某个整数s,我们构建段[s, x1],[s, x2],…,[s, xn]。注意,如果xi using namespace std; ......
codeforces Points Power 857E div3

Codeforces 1857D:Strong Vertices 与图论无关的出度最大统计

# [1857D.Strong Vertices](https://codeforces.com/contest/1857/problem/D "Codeforces 1855B") ## Description: - 给定两个长度均为 $n$ 的数组 $a$ 和 $b$ (编号$1$~$n$),如 ......
Codeforces Vertices Strong 1857D 1857

Codeforces Round 891 (Div. 3)

## A. Array Coloring ### 题意 给你 $n(2\le n\le50)$ 个数,你可以把每个数染成红或蓝,求是否有方案满足每个颜色都有数而且两种颜色每个颜色内所有数之和的奇偶性相同。多组数据 $(t\le1000)$。 例如:$[1,2,4,3,2,3,5,4]$ 染成 $[\ ......
Codeforces Round 891 Div

P9504 『MGOI』Simple Round I | C. 魔法禁林

赛时第一眼看,是个无向图,求一个点到另外一个点的最小值,诶,这不裸的最短路嘛,然后兴高采烈地倒着跑了个 `dijkstra`,喜提 $30$ 分。仔细一看,$w \le 100$,发现当 $k > 100$ 时,生命就是永恒的,于是加了个剪枝,就过啦。 具体地,正常的最短路量有一个,本题有两个。于是 ......
Simple 魔法 P9504 Round 9504

牛客周赛 Round 6

# 牛客周赛 Round 6 ## [A-游游的数字圈_牛客周赛 Round 6 (nowcoder.com)](https://ac.nowcoder.com/acm/contest/62622/A) **枚举即可** ```c++ #include #define int long long u ......
Round

Codeforces Round 890 (Div. 2) supported by Constructor Institute A-E1

A n=50非常小 所以直接暴力枚举 枚举每次把某个数以下的全部减完 然后看一下是否上升就行 https://codeforces.com/contest/1856/submission/217275334 B题直接 贪心 前面优先放最小的 最后一个放最大的 然后如果重复了就到前面去看能不能调整一下 ......

Codeforces Round 890 (Div. 2)

## [A.Tales of a Sort](https://codeforces.com/contest/1856/problem/A) ### 题目大意 Alphen has an array of positive integers $a$ of length n. Alphen can pe ......
Codeforces Round 890 Div

ACCESS 说一说Round,VAL与NZ这三个函数在SQL中的应用

Round是用来处理浮点计算的,如果不处理,原本一个29.9,它能给你算成29.899500000012345. 如果字段属性是文本格式,你再怎么round都没用,所以在这之前,你得把文本类型的字段,转成数字类型的字段.方法也很简单,比如 [字段]*1.但是这里又会产生一个新的问题,比如字段下面有n ......
函数 三个 ACCESS Round VAL

Codeforces Round #890 Div.2

[link](https://codeforces.com/contest/1856) 题号:1856A~E2 ## [A](https://codeforces.com/contest/1856/problem/A) 题面: >给定一个正整数 $n$ 和一个长度为 $n$ 的序列 $a$,重复执行 ......
Codeforces Round 890 Div

Codeforces Round 890 (Div. 2) A-E1

## A. Tales of a Sort 题意:给出一个长为n的数组a,每次操作可以使得所有的数-1,最小不会小于0,问至少需要多少次操作才能使得a变得有序。 ### Solution 把数组a排序,从大到小遍历,如果当前的$a[i]$不是原来的话,那么要想让它有序,必须进行当前的$a[i]$次操 ......
Codeforces Round 890 A-E Div

『MGOI』Simple Round I | B. 魔法照相馆 题解

[题目传送门](https://www.luogu.com.cn/problem/P9503) 一道模拟题。 并不复杂的模拟题,也不需要用到贪心。 我们可以创建一个数组来记录每个幕布是否被拉上,统计答案的时候,就看看这块幕布前面有多少个没拉上的,最后如果这块幕布拉上了,就重新放下来就行了。 ```c ......
题解 照相馆 Simple 魔法 Round

【LGR-148-Div.3】洛谷基础赛 #1 & MGOI Round I

# [【LGR-148-Div.3】洛谷基础赛 #1 & MGOI Round I](https://www.luogu.com.cn/contest/101050#problems) ## P9502 『MGOI』Simple Round I | A. 魔法数字 ### 思路 通过题目信息,可以很 ......
基础 Round MGOI LGR 148

Codeforces Round 890 (Div.2)

赛时没想到c是二分答案 ## C. To Become Max ### 题意 给定一个长度为$n$的数组$a$,可对$a_i$加1当$a_i\le a_{i+1}$,最多可进行$k$次这样的操作,求最多$k$次操作后数组$a$中的最大值。 ### 思路 首先找出原数组中最大的值,然后枚举1到n-1, ......
Codeforces Round 890 Div

[刷题笔记] 『MGOI』Simple Round I | C. 魔法禁林

[Problem](https://www.luogu.com.cn/problem/P9504) ### Description 在一张**无向简单连通图**上,某人需要从$s$点走到$t$点,她初始有两个值,分别为**魔力值**,**生命值**,每条边上都有一个怪,假设她当前的魔力值为$k$,怪 ......
笔记 Simple 魔法 Round MGOI

Codeforces Round 890 (Div. 2) supported by Constructor Institute

# Preface 现在开始严格按照**双号上分法**来打CF了,大致就是每次比赛都拿两个号中分较少的那个打,这样可以保证两个号的最高分不降 然后昨天打完就后悔了,没有拿*hl666*那个号打导致没抓住难得的上分机会,本来可以打到橙名渡劫局的但分全加在*Kusanagi_Misuzu*那个号上了 不 ......

【题解】Codeforces Round 890(CF1856)

赛时过了 A-E1,rk195 可惜是 E2 傻逼了不会背包优化了,直接连普及组水平都不到了。 ## A.Tales of a Sort ### 题目描述: 给定长度为 $n$ 的序列 $a$,每次操作为对于所有 $i$ 将 $a_i$ 变为 $\max(a_i-1,0)$,询问最少多少次操作之后可 ......
题解 Codeforces Round 1856 890

【题解】Luogu[P9504] 『MGOI』Simple Round I C. 魔法禁林

[Link](https://www.luogu.com.cn/problem/P9504) 这题我们发现如果直接去枚举生命和法力值显然是不行的,又看到说最小的生命值,不禁想到最短路,但是怎么跑? 我们令经过一条边之前魔力值为 $k$,那么该边的边权为 $\lfloor\dfrac{w}{k}\rf ......
题解 Simple 魔法 Luogu P9504

【LGR-148-Div.3】洛谷基础赛 #1 & MGOI Round I

# [【LGR-148-Div.3】洛谷基础赛 #1 & MGOI Round I](https://www.luogu.com.cn/contest/101050#description) ### 据说是普及组难度? ## T1 [P9502 『MGOI』Simple Round I | A. 魔 ......
基础 Round MGOI LGR 148

【LGR-148-Div.3】洛谷基础赛 #1 & MGOI Round I

# [【LGR-148-Div.3】洛谷基础赛 #1 & MGOI Round I](https://www.luogu.com.cn/contest/101050) ![](https://cdn.luogu.com.cn/upload/image_hosting/g76g8e1g.png) ## ......
基础 Round MGOI LGR 148

【LGR-148-Div.3】洛谷基础赛 #1 & MGOI Round I

## T1 简单题,题面十分清晰,就是给我们$n$,要求使$2^m #define ll long long #define re register using namespace std; const int N=800, INF=0x3f3f3f3f; ll n; int main(){ cin ......
基础 Round MGOI LGR 148

CodeForces 数学类题目 做题汇总

# 写一下$3$月$28$日起开始做的题目感受: ## 1. CF1793B Fedya and Array: 普及- *1100 ### [Luogu链接](http://www.luogu.com.cn/problem/CF1793B) ### [CF链接](https://codeforces ......
CodeForces 题目 数学

Codeforces Round 690 (Div. 3)

# Codeforces Round 690 (Div. 3) https://codeforces.com/contest/1462 ## A. Favorite Sequence 按题意输出 ```CC #include using namespace std; const int N = 1e ......
Codeforces Round 690 Div

Codeforces Round 890 (Div. 2)

## Tales of a Sort >![image-20230806130431932](https://zeoy-typora.oss-cn-hangzhou.aliyuncs.com/image-20230806130431932.png) ### 题解 >* 找到最大的能够产生逆序对的数即 ......
Codeforces Round 890 Div

Codeforces Round 890 (Div. 2) supported by Constructor Institute ————C - To Become Max

关于这场div2,只能说一言难尽 C题可以二分的,赛时看到n 点击查看代码 ``` #include #define int long long using namespace std; const int N=1e6+7; int mod=1e9+7; int a[N]; int n,k; voi ......

Codeforces Round 890 (Div. 2) supported by Constructor Institute 题解

# A. Tales of a Sort 关键就是找逆序对 记一组逆序对下标为 $l,r$,则求出最大的 $a_l$ 即可 # B. Good Arrays 记要构造的 Good Array 为 $b$ 前置:$\forall 1\le i\le n,b_i=1$ 然后 $O(n)$ 扫一遍看一下有 ......