随笔分类 - 算法基础—排序
摘要:Problem Description TI10 and ICPC World Finals 2020, which will be held earlier? Take a bet! The International(TI) is the biggest and most prestigious
阅读全文
摘要:AquaMoon has 𝑛n friends. They stand in a row from left to right, and the 𝑖i-th friend from the left wears a T-shirt with a number 𝑎𝑖ai written on
阅读全文
摘要:1711. 大餐计数 难度中等83收藏分享切换为英文接收动态反馈 大餐 是指 恰好包含两道不同餐品 的一餐,其美味程度之和等于 2 的幂。 你可以搭配 任意 两道餐品做一顿大餐。 给你一个整数数组 deliciousness ,其中 deliciousness[i] 是第 i 道餐品的美味程度,返回
阅读全文
摘要:Prof. Pang plays chess against his rival Prof. Shou. They are the only two players in the game. The chessboard is very large and can be viewed as a 2D
阅读全文
摘要:Phoenix has a string ss consisting of lowercase Latin letters. He wants to distribute all the letters of his string into kk non-empty strings a1,a2,…,
阅读全文
摘要:Writing light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light no
阅读全文
摘要:题目描述 You have n n n students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had
阅读全文
摘要:You have array of nn numbers a1,a2,…,ana1,a2,…,an . Rearrange these numbers to satisfy |a1−a2|≤|a2−a3|≤…≤|an−1−an||a1−a2|≤|a2−a3|≤…≤|an−1−an| , where
阅读全文
摘要:Many years ago Berland was a small country where only nn people lived. Each person had some savings: the ii -th one had aiai burles. The government co
阅读全文
摘要:Advanced CPU Manufacturer (ACM) is one of the best CPU manufacturer in the world. Every day, they manufacture n CPU chips and sell them all over the w
阅读全文
摘要:有时候快排/归并之类并不简简单单只是排序,比如快排可以求第k大,归并在部分已排序的情况下效率较高不容易被卡~ #include <bits/stdc++.h> using namespace std; void merge(int a[], int l, int r, int mid) { int
阅读全文
摘要:The next lecture in a high school requires two topics to be discussed. The ii -th topic is interesting by aiai units for the teacher and by bibi units
阅读全文
摘要:output standard output You are given an array aa of length nn . You are also given a set of distinct positions p1,p2,…,pmp1,p2,…,pm , where 1≤pi<n1≤pi
阅读全文