codeforces sorting round 1839

Codeforces Round 888 (Div. 3) 题解

考场上 $7$ 题做出来 $4$ 题,最后几分钟才把 D 题调出来,但还是吃了不少罚时 # A. Escalator Conversations $O(n)$ 枚举即可,对于每个人计算需要的间隔台阶数是否在 $(0,m)$ 以内以及相差高度是否是 $k$ 的倍数 # B. Parity Sort 显 ......
题解 Codeforces Round 888 Div

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 Copying Binary String

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( ......
Educational Codeforces Round 76

Python sorted() 函数和sort()函数对比分析

## Python sorted() 函数 ### 一、概述 sorted()函数是对所有可迭代的对象进行排序操作。 **sort与sorted的区别:** sort是应用在list上的方法,sorted可以对所有可迭代的对象进行排序操作。list的sort方法返回的是对已经存在的列表进行操作,无返 ......
函数 Python sorted sort

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 ......
Educational Codeforces Round

CodeForces 1268E Happy Cactus

[洛谷传送门](https://www.luogu.com.cn/problem/CF1268E "洛谷传送门") [AtCoder 传送门](https://codeforces.com/problemset/problem/1268/E "AtCoder 传送门") 考虑一些简单的情况,比如树。 ......
CodeForces Cactus 1268E Happy 1268

【题解】Max to the Right of Min - Codeforces 1849E

**出处:** Educational Codeforces Round 152 **链接:** https://codeforces.com/problemset/problem/1849/E **题目大意:** TODO(先去看原题吧) **解题思路:** PS:这里的解题思路跟标准答案不太一样 ......
题解 Codeforces 1849E Right 1849

练习记录-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 ......
Codeforces Round 888 Div

Codeforces Round 618 (Div. 2)

# Codeforces Round 618 (Div. 2) https://codeforces.com/contest/1300 ## A. Non-zero 要求和,积都不为0,则先把全部0操作一次,然后再check 和是否为0,是的话再对任意数操作一次即可。 ```CC #include ......
Codeforces Round 618 Div

Codeforces Round 888 (Div. 3) A-F

## A. Escalator Conversations 题意:有一个扶梯,有n个人要站扶梯,这个扶梯有m个位置,第i个位置的高度为i*k,Vlad高H,第i个人高h[i],当且仅当两个人所处的位置高度加上自身身高刚好相同时才能谈话,问能和Vlad谈话的有多少人。 ### Solution 直接计 ......
Codeforces Round 888 A-F Div

sort排序

数值排序: arr.sort((a,b)=>a.id - b.id); 字符串排序: var compare = function (a, b) { if (a.name< b.name) { return -1; } else if (a.name > b.name) { return 1; } ......
sort

Codeforces Round #888 (Div. 3) A-G

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

SORT:基于检测的目标跟踪的鼻祖

本文来自公众号“AI大道理” ​ SORT是一种多目标跟踪的经典算法,整个算法是一些常规技术的简单组合,却达到了非常好的效果。Sort算法的核心是匈牙利匹配算法和卡尔曼滤波算法。 ​ 添加图片注释,不超过 140 字(可选) 1、SORT简介 SORT(Simple Online and Realt ......
鼻祖 目标 SORT

Codeforces Round 888 (Div. 3) - D

[toc] Codeforces Round 888 (Div. 3) 赛后摘记 # [D. Prefix Permutation Sums](https://codeforces.com/contest/1851/problem/D) **题意** 判断给定的长为n - 1数组,是否为某个 1 ~ ......
Codeforces Round 888 Div

Codeforces Round 888 (Div. 3)

# A. Escalator Conversations ```cpp #include using namespace std; #define int long long void solve(){ int n , m , k ,H; cin >> n >> m >> k >> H; vecto ......
Codeforces Round 888 Div

quick-sort-and-merge-sort

title: quick_sort and merge_sort toc: true date: 2022-12-10 22:38:21 tags: 排序 categories: 算法 >简介:简单记录一下快速排序与归并排序的实C++实现。 ## 1.快速排序 代码: ```cpp #include ......

Codeforces Round 888 (Div. 3)

Codeforces Round 888 (Div. 3) A - Escalator Conversations 思路:求出每个人与Vlad的身高差d,若的能被k整除,且d/k<m则YES #include<bits/stdc++.h> using namespace std; #define i ......
Codeforces Round 888 Div

Codeforces Round 888 (Div. 3)F(异或小技巧)

题意:给你一个数组长度为n的a数组,要求a数组的值为非负整数,再给你一个k,a的值全小于2的k次方,找到一个小于a的k次方的值x,再从a中找到两个值,让他们 (ai⊕x)&(aj⊕x)最小 结论:n个数的最小异或对的答案就是排序后最小的相邻异或和 思路:(ai⊕x)&(aj⊕x)的最高位为1,可以把 ......
Codeforces 技巧 Round 888 Div

源码解析Collections.sort ——从一个逃过单测的 bug 说起

本文从一个小明写的bug 开始,讲bug的发现、排查定位,并由此展开对涉及的算法进行图解分析和源码分析。 事情挺曲折的,因为小明的代码是有单测的,让小明更加笃定自己写的没问题。所以在排查的时候,也经历了前世的500年,去排查排序后的list改动(**主要是小明和同事互相怀疑对方的代码,不多说了**) ......
Collections 源码 sort bug

【题解】Educational Codeforces Round 150(CF1841)

赛时过了 A-E,然后就开摆了,为什么感觉 C 那么无厘头[发怒][发怒] 排名:25th ## A.Game with Board ### 题目描述: Alice 和 Bob 玩游戏,他们有一块黑板。最初,有 $n$ 个整数 $1$。Alice 和 Bob 轮流操作,Alice 先手。 轮到时,玩 ......
题解 Educational Codeforces Round 1841

Codeforces 1852A Ntarsis' Set 题解

题目传送门:[Codeforces 1852A Ntarsis' Set](https://codeforces.com/contest/1852/problem/A) # 题意 给定一个集合,里面初始有 $1,2,3...10^{1000}$,告诉你每天会拿掉其中的第 $a_1, a_2, a_3 ......
题解 Codeforces Ntarsis 1852A 1852

Codeforces Round 886 (Div. 4) D - H

D. Balanced Round E. Cardboard for Pictures F. We Were Both Children G. The Morning Star H. The Third Letter ......
Codeforces Round 886 Div

Codeforces Round 887 (Div. 2) D.Imbalanced Arrays

Problem - D - Codeforces 题目规定了一种“平衡数组”,数组中的任意一个数绝对值小于等于n且不等于零,任意两个数的和不为0,给n个数a[i],分别表示位于i的数可以与a[i]个数(包括它自己)相加为正。 现在给出n和a数组,要求构造平衡数组,不能构造的话输出-1 我们不难得出以 ......
Codeforces Imbalanced Arrays Round 887

linux 中 sort -h选项

-h:使用易读性数字,比如 K, G单位。 001、 [root@PC1 test02]# ls a.txt [root@PC1 test02]# cat a.txt ## 测试数据 2G 3K 4K 1G [root@PC1 test02]# sort a.txt 1G 2G 3K 4K [roo ......
linux sort

SMU Summer 2023 Contest Round 6

# [SMU Summer 2023 Contest Round 6](https://codeforces.com/group/L9GOcnr1dm/contest/462070) ## [A. There Are Two Types Of Burgers](https://codeforces. ......
Contest Summer Round 2023 SMU

Educational Codeforces Round 35 (Rated for Div. 2)

# Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 ## A. Nearest Minimums ```CC #include using namespace std; con ......
Educational Codeforces Round Rated Div

CodeForces 725F Family Photos

[洛谷传送门](https://www.luogu.com.cn/problem/CF725F "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/725/F "CF 传送门") 不错的贪心题。 我们考虑一对照片只有一张的情况。那么 ......
CodeForces Family Photos 725F 725

Educational Codeforces Round 71 (Rated for Div. 2)

Educational Codeforces Round 71 (Rated for Div. 2) A - There Are Two Types Of Burgers 思路:价格高的优先取 #include<bits/stdc++.h> using namespace std; #define ......
Educational Codeforces Round Rated Div

Codeforces Round 887 (Div. 2) A-D

# Codeforces Round 887 (Div. 2) ## A. Desorting 题意:给出一个数组,可以进行任意次以下操作: 选择一个i 对于数组中的a[1],a[2],...,a[i]全部+1 a[i+1]...a[n]全部-1, 问最小使得数组变得无序的操作是多少次 ### So ......
Codeforces Round 887 A-D Div