codeforces 1856d wrong more

CodeForces 1508D Swap Pass

[洛谷传送门](https://www.luogu.com.cn/problem/CF1508D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1508/D "CF 传送门") 先忽略掉所有 $a_i = i$ 的点。 考虑我 ......
CodeForces 1508D 1508 Swap Pass

Codeforces 585D Lizard Era: Beginning

很容易想到可以对于每个任务选不去的那一个人进行搜索,时间复杂度 $O(3^n)$,明显过不了。 发现 $n\le 25,\lceil \frac{n}{2}\rceil\le 13$,且各个任务间不会互相影响,便可以用折半搜索分成 $2$ 部分来搜最后来合并。 考虑如何合并两部分,令前一部分得到的值 ......
Codeforces Beginning Lizard 585D 585

Codeforces Round 881 Div2 A-F1题解

# codeforces round 881 div2 题解 马上要秋招了,自己本事全丢了,感觉如果这样的话今年就估计要饿死了。先打div3,7月份得开始收心了 ## A. Sasha and Array Coloring 题意,可以分任意组,每组的贡献是max - min,问最大贡献 显然是贪心, ......
题解 Codeforces Round Div2 881

Codeforces Round #877 (Div. 2) A-E

# A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n; cin >> n; int mx = -2e9, mi = 2e9; for (int i = 1;i > x; mi ......
Codeforces Round 877 A-E Div

Educational Codeforces Round 151 (Rated for Div. 2)

# Preface 期末考终于结束了,终于可以回来写题了 这场是刚考完最后一门的那个晚上打的,因为太久没有写代码了所以不是很熟练而且脑子也不太灵光,只能堪堪写到D题而且手速感人 上次CF第二个号因为Rating被roll了导致从紫名掉下来了,这场就把它又打上去了,再这样后面兴许要用第三个号打了 由于 ......
Educational Codeforces Round Rated 151

Educational Codeforces Round 151 [div.2 #A-C] 赛后总结(contest/1845)

### [link](https://codeforces.com/contest/1845 "Educational Codeforces Round 151") $\textcolor{52C41A}{A}-\textcolor{FADB14}{B}-\textcolor{FADB14}{C}- ......
Educational Codeforces contest Round 1845

CodeForces 高分段 dp 选做

选取方式:CF *3000+ 按通过人数排序。 ### [CF1188D Make Equal](https://www.luogu.com.cn/problem/CF1188D) 记 $cnt(x)$ 表示 $x$ 二进制下 $1$ 的个数,题目等价于求 $x$ 使得 $$\sum_{x=1}^n ......
CodeForces dp

Educational Codeforces Round 151 F. Swimmers in the Pool

### 一.前言 本来打算打打这个比赛玩玩,结果同学找我打游戏王去了,就没打现场(逃) 因为是一道不错的数学题,来写写补题的题解 这里点名批评 @[HOLIC](https://codeforces.com/profile/HOLlC) 喂给我的假题意,让我查错大半天,最后发现题意错了还重新推了好多 ......
Educational Codeforces Swimmers Round Pool

CodeForces 1845C Strong Password

[洛谷传送门](https://www.luogu.com.cn/problem/CF1845C "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1845/C "CF 传送门") 我怎么这么多天没写题解了,快来水一篇。 考虑对 ......
CodeForces Password Strong 1845C 1845

python: more Layer Architecture and its Implementation in SQLite

sqlite3: CREATE TABLE DuStudentList ( StudentId INTEGER PRIMARY KEY AUTOINCREMENT, StudentName TEXT NOT NULL, StudentNO TEXT NOT NULL, StudentBirthday ......

Educational Codeforces Round 151 (Rated for Div. 2)(C,D)

# Educational Codeforces Round 151 (Rated for Div. 2)(C,D) ## C(dp,子序列自动机) [C](https://codeforces.com/contest/1845/problem/C) 题目大意就就是给你一个字符串$s$,还给出两个边 ......
Educational Codeforces Round Rated 151

Educational Codeforces Round 151 (Rated for Div. 2) A~D

A. Forbidden Integer 模拟: void solve(){ int n,k,x; cin>>n>>k>>x; if(x!=1){ cout<<"YES\n"<<n<<"\n"; for(int i=1;i<=n;i++) cout<<"1"<<" \n"[i==n]; return ......
Educational Codeforces Round Rated 151

Educational Codeforces Round 151 (Rated for Div

## C. Strong Password >给定一个字符串$s$,一个密码的长度$m$,下界字符串$l$和上界字符串$r$,上下界字符串长度均为$m$,且字符只在0~9范围内,上界字符串的第 $i$ 位非严格大于下界字符串的第 $i$ 位,密码的第 $i$ 位需要位于 $[l_i, r_i]$ 内 ......
Educational Codeforces Round Rated 151

python: more Layer Architecture and its Implementation in Python and mysql 8.0

mysql 8.0: drop table DuStudentList; #学生表 create table DuStudentList ( StudentId INT NOT NULL AUTO_INCREMENT comment'主键id', #自动增加, StudentName nvarcha ......

ErrorCode17410(No more data to read from socket)错误

系统运行的过程中莫名其妙出现ErrorCode17410(No more data to read from socket)错误,只是某一个功能的sql执行出现,但是把sql语句复制到plsql执行又没问题,后面尝试对数据库的进程都清理就好了,应该是进程占用出了问题,具体命令如下 ```sh ps ......
ErrorCode 错误 socket 17410 more

Codeforces 1458F - Range Diameter Sum

先考虑直径的一些求法:最普遍的想法肯定是从点集中任意一个点开始 DFS 找到距其最远的点,再一遍 DFS 找到距离你找到的那个点最远的点。但是放在这个题肯定是不太行的。因此考虑一种更常用的求法:**合并**。更直观地说:我们定义树上一个圆 $(x,r)$ 表示距离 $x$ 点 $\le r$ 的所有 ......
Codeforces Diameter 1458F Range 1458

Codeforces[CF1036B]Diagonal Walking v.2题解

# 题目大意 很明显,这道题就是求 k 步之内到达点 $(a,b)$ ,然后尽量走对角线,求能走对角线的最大值。 # 做题思路 首先明白一个事实,即一个对角线可以通过增加一步而抵达点不变,如图: ![image](https://img2023.cnblogs.com/blog/3175066/20 ......
题解 Codeforces Diagonal Walking 1036B

python: more Layer Architecture and its Implementation in Python

sql server: --学生表 DROP TABLE DuStudentList GO create table DuStudentList ( StudentId INT IDENTITY(1,1) PRIMARY KEY, StudentName nvarchar(50), StudentN ......

Codeforces Round 881 (Div. 3)

~~失踪人口回归~~ VP 打的 ### A. Sasha and Array Coloring ``` int n; int a[maxN]; void solve(){ n=rd(); fp(i,1,n) a[i]=rd(); sort(a+1,a+n+1); ll ans=0; for(int ......
Codeforces Round 881 Div

Codeforces 1648F - Two Avenues

为啥会有人觉得这是板子题啊/tuu 先对图边双连通分量缩个点,然后考虑对两条边分情况讨论: - 两个桥边,显然答案就是经过这两个桥的路径数量之和,排序取前两大的即可。 - 一个桥边加一个非桥边,答案是经过那个桥边的路径数量,显然桥边数量 $\ge 2$ 肯定不用考虑这种情况,桥边数量 $=1$ 另外 ......
Codeforces Avenues 1648F 1648 Two

Linux系统编程21-简单的more命令实现

/dev/tty: 键盘和显示器设备描述文件 - 向该文件写->显示在用户屏幕 - 向该文件读->从键盘获取用户输入 当more需要用户输入可以从/dev/tty得到数据 ```c #include #include #define PAGELEN 24 #define LINELEN 512 vo ......
命令 系统 Linux more 21

CodeForces 605E Intergalaxy Trips 题解

## 题意 > 有一张 $n$ 个点的有向完全图,边 $i \to j$ 有 $p_{i,j}$ 的概率出现($p_{i,i}=1$)。你要从 $1$ 开始,每天可以走一条出边或留在原地,求最优策略下走到 $n$ 的期望天数。输出小数(不取模)。 > $n \le 10^3$ ## 思路 设 $f( ......
题解 Intergalaxy CodeForces Trips 605E

Codeforces 1787H - Codeforces Scoreboard(平衡树优化 dp)

令 $c_i=b_i-a_i$,等价于我们钦定一个排列 $p$,最小化 $\sum \min(p_ik_i,c_i)$,拿 $\sum b_i$ 减去之就是答案。 我们钦定一些 $i$ 满足 $p_ik_iY.k;} }a[MAXN+5]; struct node{int ch[2],siz,key ......
Codeforces Scoreboard 1787H 1787

Educational Codeforces Round 150 (Rated for Div. 2) A-E

[比赛链接](https://codeforces.com/contest/1841) # A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n; cin >> n; if (n ......
Educational Codeforces Round Rated 150

CodeForces 1842E Tenzing and Triangle

[洛谷传送门](https://www.luogu.com.cn/problem/CF1842E "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1842/problem/E "CF 传送门") 一个很显然的观察:选择的三角形两两重叠面积为 $0$, ......
CodeForces Triangle Tenzing 1842E 1842

CodeForces 1842G Tenzing and Random Operations

[洛谷传送门](https://www.luogu.com.cn/problem/CF1842G "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1842/problem/G "CF 传送门") 原来还不会这种拆期望的套路![](//图.tk/0) ......
CodeForces Operations Tenzing Random 1842G

CodeForces 1842F Tenzing and Tree

[洛谷传送门](https://www.luogu.com.cn/problem/CF1842F "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1842/problem/F "CF 传送门") 事实上自己方向一直是错的…… 绝对值不好弄,我一开始的 ......
CodeForces Tenzing 1842F 1842 Tree

Codeforces Round 875 (Div. 2) C. Copil Copac Draws Trees

bfs解法 如果是暴力求解的话就每次都扫描一次所有边直到所有点都和树连接 优化:每次扫描我们可以发现会重复扫描那些已经存在树中的边了,因此我们可以只扫描还没有存在树中的边且是没扫过的边 对于每次更新,比如由点a已经在树中,更新点b,我们只需判断点a被更新到树中点的编号和a-b边的编号的大小,如果比它 ......
Codeforces Round Copil Copac Draws

Codeforces Round #879 (Div. 2) A-E

[比赛链接](https://codeforces.com/contest/1834) # A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n; cin >> n; int c ......
Codeforces Round 879 A-E Div

Codeforces Round 781 (Div. 2) E. MinimizOR (可持久化字典树)

[传送门](https://codeforces.com/contest/1665/problem/E) 题目大意: ** T组测试数据每组测试数据先输入一个n表示有一个长度为n的一维数组,然后输入n个数字表示这个一维数组。紧接着输入一个k表示有k个询问,对于每个询问会输入一个l和一个r表示询问数组 ......
字典 Codeforces MinimizOR Round 781