CF1286E-Fedya the Potter Strikes Back[KMP,RMQ]

Topics Title link: https://www.luogu.com.cn/problem/CF1286E Topic Essentials Define a string s s The weight of s is for each s L ∼ ...

Posted by stukov on Thu, 11 Aug 2022 21:26:50 +0300

Codeforces Round #572 Div2 A~E problem solution

Site link: Codeforces Round #572 Div2 gossip It was a great fight, with 148 in the end However, this is mainly a conclusion question, so I won't do much explanation D2 is more immortal, so you can fill it out later A. Keanu Reeves Given a binary string s, defining a string is awesome if and only if the number of zeros and 1s in the string is di ...

Posted by Hillary on Mon, 23 May 2022 11:47:20 +0300

Codeforces Round #603 (Div. 2) ABC problem solution

A. Sweet Problem There are three numbers. You can choose two - 1 at a time. How many times can you choose at most. Idea: be greedy. The strategy is as follows: 1. First arrange the three numbers in order. 2. Then, if the largest and the second largest are different, reduce the largest and the smallest together and try to be as large as the seco ...

Posted by mulysa on Sat, 21 May 2022 21:34:36 +0300

CF 1405E Fixed Point Removal

CF 1405E Fixed Point Removal Meaning: Given the sequence \ (A \) with length \ (n \), the number of \ (A_i = i \) (i.e. the value is equal to its subscript) can be deleted in each operation, and then the remaining arrays are spliced together to ask how many can be deleted at most \(q \) independent inquiries. Set the number of the first \ ...

Posted by bakigkgz on Thu, 19 May 2022 08:38:13 +0300

CF773F Test Data Generation

CF773F Test Data Generation Failed to push it out by yourself / kk Obviously, the limitation of the title is: Le \ max, and select odd number (\ \(a_n\bmod 2=0,\dfrac{a_n}{g}\bmod 2=1\) Directly enumerating the power of the highest \ (2 \) of \ (g \) can convert the limit two into: select a number in \ ([1,\dfrac{max_a}{2^k}] \), and the ...

Posted by Paingiver on Fri, 29 Apr 2022 04:28:35 +0300

Codeforces Round #784 (Div. 4) All Problems

Codeforces Round #784 (Div. 4) preface: The topics are very novice, in line with d i v 4 div4 div4 should have some difficulty, and contributed to me for the first time in history ...

Posted by jasonbullard on Thu, 21 Apr 2022 21:18:27 +0300

Codeforces Round #702 (Div. 3)

Site link: Codeforces Round #702 (Div. 3) A. Dense Array #include <bits/stdc++.h> using namespace std; typedef long long ll; #define forn(i,x,n) for(int i = x;i <= n;++i) const int N = 55; int a[N]; int main() { int T;scanf("%d",&T); while(T--) { int n;scanf("%d",&n); forn(i,1,n) scanf("%d",&a[i]); int res = ...

Posted by JOWP on Mon, 18 Apr 2022 13:53:16 +0300

Codeforces 1491H. Yuezheng Ling and Dynamic Tree

Main idea of the topic: given a tree with a size of \ (n \) and a \ (1 \) as the root node, the tree is given in the following way: enter \ (a_2,a_3,\dots,a_n \), ensure \ (1 \ Leq a_i < I \), and connect \ (a_i \) and \ (I \) to form a tree. There are two operations: 1 l r x order \ (a_i=\max(a_i-x,1)(l\leq i\leq r) \). 2 u v query the LCA ...

Posted by xsaero00 on Thu, 14 Apr 2022 06:18:17 +0300

CF1499D The Number of Pairs

Firstly, from peishu theorem, it can be obtained that for the equation LCM (a, b) * C + GCD (a, b) * (- D) = x, X must be a multiple of gcd(gcd(a,b),lcm(a,b)) Obviously, after gcd(gcd(a,b),lcm(a,b))=gcd(a,b), the divisor of x can be enumerated as gcd(a,b) within the time of root x Since C, D and X are given, lcm(a,b) can also be obtained dire ...

Posted by David4321 on Thu, 31 Mar 2022 21:56:59 +0300