题目描述: You are given an array consisting of nmonotonic renumeration as an array b consisting of \(n\)integers such that all of the following conditions are met: b1=0; for every pair of indices iand jsuch that 1≤i,j≤n, then \(b_i=b_j\), it is still pos…
这个题还是不太懂,下面附上的是大佬的题解(https://zhanghuimeng.github.io/post/codeforces-1102e-monotonic-renumeration/) E. Monotonic Renumeration time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given an ar…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 会发现如果a[i]=a[j] 那么b[i]~b[j]都是相同的,等于b[i] 而b[i]等于b[i-1]+1或者b[i] 有两种可能 所以对于两个相同的a[i]之间的区间. 只要在区间开始的时候乘个2就行. 如果不在任何一起相等的区间里面的话也乘个2就行,因为每个数字都有两种可能. 这道题只要记录下=a[i]的最大下标就好. 这样 在遇到一个a[i]的时候,就获取 =a[i]的最大下标j. 显然i~j是这个区间的最大范围. 只要是这个范围…
题意:给出一个长度为\(n\)的序列\(a\),根据\(a\)构造一个序列\(b\),要求: ​ 1.\(b_{1}=0\) ​ 2.对于\(i,j(i\le i,j \le n)\),若\(a_{i}=a_{j}\),则\(b_{i}=b_{j}\) ​ 3.对于\(i\in [1,n-1]\),有\(b_{i+1}=b_{i}\)或\(b_{i+1}=b_{i}+1\) 求有多少可能的\(b\),答案对\(998244353\)取模. 题解:由第二个条件能知道,对于所有\(a_{i}=a_{…
要点 主要学到的东西:一个序列染色,相邻不染同色,恰用\(j\)种颜色的1.模式数.2.方案数.3.具体染色数. 从大的思路上来讲:先dp预处理出每一层的模式数:\(f[i][j]\)表示\(i\)个位置恰染\(j\)个颜色的模式数,然后再dp出各层之间的转移:\(dp[i][j]\)表示\(i\)层恰染\(j\)个颜色的具体染色数,用上一轮的答案乘上这一层的具体染色数(是\(f[l[i]][j]*A_m^j\))再减去这层和上层重复的. 我将染色的阶段分为三个阶段.虽然题目中总是让求方案数但不…
There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less than one girl. How many ways are there to choose a gro…
Codeforces 15E Triangles Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by t…
题目描述: Sagheer and Nubian Market time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and re…
题目描述: Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to t…
题目描述: Description This task is very simple. Given a string S of length n and q queries each query is on the format i j k which means sort the substring consisting of the characters from i to j in non-decreasing order if k = 1 or in non-increasing ord…