
补题
未打过的比赛补一补
MySGDLife
总分总
展开
-
Educational Codeforces Round 96 (Rated for Div. 2) E. String Reversal 树状数组
题意: 将一个字符串只能通过相邻字符交换从而反转,问需要多少次数 思路: 我们从末尾开始,往前把字符交换,如果字符串里没有重复字母的话,这样就是最优秀的 , 相邻交换,求逆序对即可 ,但对于有重复字母,我们需要肯定将较前的字母先往前把字符交换,这样次数一定会更少,所有从后往前遍历,记录下标,这样保证前面的字符会首先取得,用栈也可以,然后选择好位置用树状数组求逆序对即可 #include <bits/stdc++.h> using namespace std; const int N = 2.原创 2020-12-03 16:15:28 · 193 阅读 · 0 评论 -
Codeforces Round #672 (Div. 2) C1. Pokémon Army (easy version)
This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved. Pikachu is a cute and friendly pokémon living in the wild pikac原创 2020-11-26 22:27:34 · 191 阅读 · 0 评论 -
Codeforces Round #672 (Div. 2) B. Rock and Lever
Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them. Hermit Lizard agreed to give Danik the lever. But to get a stone, Danik needs to solve the following task. You are given a positive intege原创 2020-11-26 22:20:51 · 187 阅读 · 0 评论 -
Codeforces Round #672 (Div. 2) A
Wheatley decided to try to make a test chamber. He made a nice test chamber, but there was only one detail absent — cubes. For completing the chamber Wheatley needs n cubes. i-th cube has a volume ai. Wheatley has to place cubes in such a way that they wou原创 2020-11-26 22:02:38 · 208 阅读 · 0 评论 -
Codeforces Round #671 (Div. 2) D2. Sage‘s Birthday (hard version)
outputstandard output This is the hard version of the problem. The difference between the versions is that in the easy version all prices ai are different. You can make hacks if and only if you solved both versions of the problem. Today is Sage’s birthday,原创 2020-11-25 23:28:13 · 162 阅读 · 0 评论 -
Codeforces Round #671 (Div. 2) C. Killjoy
outputstandard output A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large). Killjoy’s account is already infected and has原创 2020-11-25 23:22:27 · 136 阅读 · 0 评论 -
Codeforces 667div3 D.Decrease the Sum of Digits
You are given a positive integer n. In one move, you can increase n by one (i.e. make n:=n+1). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s. You have to answer t ind原创 2020-09-08 11:54:53 · 184 阅读 · 0 评论 -
CodeForces 667div3 C.Yet Another Array Restoration
We have a secret array. You don’t know this array and you have to restore it. However, you know some facts about this array: The array consists of n distinct positive (greater than 0) integers. The array contains two elements x and y (these elements are kn原创 2020-09-08 11:49:01 · 305 阅读 · 0 评论 -
Codeforces Round #661 (Div. 3) Binary String To Subsequences 队列
题意: 给你一个01串 要求把他分成不同的子序列 并且子序列中不能有两个相同的数相邻 输出分成最少子序列的个数 并且 输出每个0或者1分别在哪个子序列 思路: 一开始看到这个题,就想到用栈或者队列来模拟这个过程,vector来存答案,但是栈无法得到最初未配对0或者1出现的位置,所以采用队列,我们开两个队列,一个用来存0的位置,一个用来存1的位置。 1.当遇到0时,首先肯定先找有没1和他配对,如果队列1为空的话,说明这个0得属于新的一个序列,就往vector里存答案,如果有的话,往答案里存入队列1里队头序列的原创 2020-08-06 11:54:45 · 154 阅读 · 0 评论 -
Codeforces Round #635 (Div. 2)
A. 题意:给出四个数 a b c d 要求从 a到b b到c c到d 选三个数构造三角形 思路:选b c c 就行 了 一定满足题意 B. 思路:贪心 一直使用第一种方法 然后在判断第二种方法能否将其杀死 记得特判单纯第二种方法就能杀死的情况 样例有给 #include <bits/stdc++.h> using namespace std; #define LL long lo...原创 2020-04-19 00:14:02 · 211 阅读 · 0 评论 -
Codeforces Round #622 (Div. 2) B、C
B. Different Rules time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Nikolay has only recently started in competitive programming, but already qu...原创 2020-04-10 00:35:06 · 149 阅读 · 0 评论 -
Codeforces Round #623D. Recommendations并查集
D. Recommendations time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output VK news recommendation system daily selects interesting publications of one...原创 2020-04-02 23:55:56 · 225 阅读 · 0 评论 -
Codeforces Round #624 (Div. 3)D. Three Integers
D. Three Integers time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given three integers a≤b≤c. In one move, you can add +1 or −1 to any...原创 2020-03-31 20:49:40 · 194 阅读 · 1 评论 -
Codeforces Round #624 (Div. 3)
C. Perform the Combo time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You want to perform the combo on your opponent in one popular fighting ga...原创 2020-03-31 20:43:30 · 208 阅读 · 0 评论 -
Ozon Tech Challenge 2020 (Div.1 + Div.2, Rated, T-shirts + prizes!)
C. Kuroni and Impossible Calculation time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output To become the king of Codeforces, Kuroni has to solve the ...原创 2020-03-30 21:31:12 · 656 阅读 · 0 评论 -
牛客练习赛60补题
A.https://ac.nowcoder.com/acm/contest/4853/A 思路:考虑位运算&的特性 只有两者都为1才会对答案有贡献 且 对答案贡献的值为 1 << k 其中k是当前1所在二进制下的位数 所以考虑预处理每一个位的1出现的次数 其中对每一位都会遍历n*n次 所以每一位对答案的贡献就是 a[i]a[i](1 << i) a[i]为当...原创 2020-03-29 13:43:06 · 128 阅读 · 0 评论 -
Codeforces Round #625 (Div. 2, based on Technocup 2020 Final Round)
A. A. Contest for Robots time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Polycarp is preparing the first programming contest for robots. There ...原创 2020-03-29 18:56:58 · 306 阅读 · 0 评论