AtCoder Beginner Contest 322 (A~F题)

A - First ABC 2

Description

Problem Statement

You are given a string S S S of length N N N consisting of A, B, and C.

Find the position where ABC first appears as a (contiguous) substring in S S S. In other words, find the smallest integer n n n that satisfies all of the following conditions.
1 ≤ n ≤ N − 2 1 \leq n \leq N - 2 1nN2.
The string obtained by extracting the n n n-th through ( n + 2 ) (n+2) (n+2)-th characters of S S S is ABC.
If ABC does not appear in S S S, print -1.

Constraints

3 ≤ N ≤ 100 3 \leq N \leq 100 3N100
S S S is a string of length N N N consisting of A, B, and C.

Input

The input is given from Standard Input in the following format:

N N N
S S S

Output

Print the position where ABC first appears as a substring in S S S, or -1 if it does not appear in S S S.

Sample Input 1
8
ABABCABC
Sample Output 1
3

ABC first appears in S S S at the 3 3 3-rd through 5 5 5-th characters of S S S. Therefore, the answer is 3 3 3.

Sample Input 2
3
ACB
Sample Output 2
-1

If ABC does not appear in S S S, print − 1 -1 1.

Sample Input 3
20
BBAAABBACAACABCBABAB
Sample Output 3
13

Solution

对于每一个起始位置,进行判断是否能构成 ABC 即可。


Code

#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    
    int N;
    string s;
    
    cin >> N >> s;
    
    for (int i = 0; i < s.size(); i ++)
    	if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
    	{
    		cout << i + 1 << endl;
    		return 0;
		}
		
	cout << -1 << endl;

	return 0;
}


B - Prefix and Suffix

Description

Problem Statement

You are given two strings S S S and T T T consisting of lowercase English letters. The lengths of S S S and T T T are N N N and M M M, respectively. (The constraints guarantee that N ≤ M N \leq M NM.)
S S S is said to be a prefix of T T T when the first N N N characters of T T T coincide S S S.

S S S is said to be a suffix of T T T when the last N N N characters of T T T coincide S S S.
If S S S is both a prefix and a suffix of T T T, print 0 0 0;

If S S S is a prefix of T T T but not a suffix, print 1 1 1;

If S S S is a suffix of T T T but not a prefix, print 2 2 2;

If S S S is neither a prefix nor a suffix of T T T, print 3 3 3.

Constraints

1 ≤ N ≤ M ≤ 100 1 \leq N \leq M \leq 100 1NM100
S S S is a string of length N N N consisting of lowercase English letters.
T T T is a string of length M M M consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

N N N M M M
S S S
T T T

Output

Print the answer according to the instructions in the problem statement.

Sample Input 1
3 7
abc
abcdefg
Sample Output 1
1

S S S is a prefix of T T T but not a suffix, so you should print 1 1 1.

Sample Input 2
3 4
abc
aabc
Sample Output 2
2

S S S is a suffix of T T T but not a prefix.

Sample Input 3
3 3
abc
xyz
Sample Output 3
3

S S S is neither a prefix nor a suffix of T T T.

Sample Input 4
3 3
aaa
aaa
Sample Output 4
0

S S S and T T T may coincide, in which case S S S is both a prefix and a suffix of T T T.


Solution

通过枚举判断是否是前缀或后缀即可,最后按照要求输出。


Code

#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    
    int N, M; 
    string s, t;
    
    cin >> N >> M;
    cin >> s >> t;
    
    bool flg1 = 1;
    for (int i = 0; i < N; i ++)
    	if (s[i] != t[i])
    	{
    		flg1 = 0;
    		break;
		}
	bool flg2 = 1;
	for (int i = N - 1; i >= 0; i --)
    	if (s[i] != t[M - N + i])
    	{
    		flg2 = 0;
    		break;
		}
		
	if (flg1 && flg2) cout << 0 << endl;
	else if (flg1) cout << 1 << endl;
	else if (flg2) cout << 2 << endl;
	else cout << 3 << endl;

	return 0;
}

C - Festival

Description

Problem Statement

The AtCoder Kingdom holds a festival for N N N days. On M M M of these days, namely on the A 1 A_1 A1-th, A 2 A_2 A2-th, … \dots , A M A_M AM-th days, fireworks will be launched. It is guaranteed that fireworks will be launched on the last day of the festival. (In other words, A M = N A_M=N AM=N is guaranteed.)
For each i = 1 , 2 , … , N i=1,2,\dots,N i=1,2,,N, solve the following problem.
How many days later from the i i i-th day will fireworks be launched for the first time on or after the i i i-th day? If fireworks are launched on the i i i-th day, it is considered to be 0 0 0 days later.

Constraints

1 ≤ M ≤ N ≤ 2 × 1 0 5 1 \le M \le N \le 2 \times 10^5 1MN2×105
1 ≤ A 1 ≤ A 2 ≤ ⋯ ≤ A M = N 1 \le A_1 \le A_2 \le \dots \le A_M = N 1A1A2AM=N
All input values are integers.

Input

The input is given from Standard Input in the following format:

N N N M M M
A 1 A_1 A1 A 2 A_2 A2 … \dots A M A_M AM

Output

Print N N N lines.
The i i i-th line ( 1 ≤ i ≤ N ) (1 \le i \le N) (1iN) should contain an integer representing the number of days from the i i i-th day until fireworks are launched for the first time on or after the i i i-th day.

Sample Input 1
3 2
2 3
Sample Output 1
1
0
0

The kingdom holds a festival for 3 3 3 days, and fireworks are launched on the 2 2 2-nd and 3 3 3-rd days.
From the 1 1 1-st day, the first time fireworks are launched is the 2 2 2-nd day of the festival, which is 1 1 1 day later.
From the 2 2 2-nd day, the first time fireworks are launched is the 2 2 2-nd day of the festival, which is 0 0 0 days later.
From the 3 3 3-rd day, the first time fireworks are launched is the 3 3 3-rd day of the festival, which is 0 0 0 days later.

Sample Input 2
8 5
1 3 4 7 8
Sample Output 2
0
1
0
0
2
1
0
0

Solution

本蒟蒻直接 无脑双指针,貌似可能不需要。
对于每一个 i i i,找出比他大的最小的数,然后输出差值即可。(lowerbound也是可以的)


Code

#include <bits/stdc++.h>
#define int long long

using namespace std;

const int SIZE = 2e5 + 10;

int N, M;
int A[SIZE]; 

signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
	
	cin >> N >> M;

	for (int i = 1; i <= M; i ++)
		cin >> A[i];
		
	int j = 1;
	for (int i = 1; i <= N; i ++)
	{
		while (j < M && A[j] < i) j ++;
		cout << A[j] - i << endl;
	}

	return 0;
}


D - Polyomino

纯模拟,跑路了……


E - Product Development

Description

Problem Statement

AtCoder Inc. is planning to develop a product. The product has K K K parameters, whose values are currently all zero. The company aims to raise all parameter values to at least P P P.
There are N N N development plans. Executing the i i i-th development plan ( 1 ≤ i ≤ N 1 \le i \le N 1iN) increases the value of the j j j-th parameter by A i , j A_{i,j} Ai,j for every integer j j j such that 1 ≤ j ≤ K 1 \le j \le K 1jK, at the cost of C i C_i Ci.
A development plan cannot be executed more than once. Determine whether the company can achieve its goal, and if it can, find the minimum total cost required to achieve the goal.

Constraints

1 ≤ N ≤ 100 1 \le N \le 100 1N100
1 ≤ K , P ≤ 5 1 \le K,P \le 5 1K,P5
0 ≤ A i , j ≤ P ( 1 ≤ i ≤ N , 1 ≤ j ≤ K ) 0 \le A_{i,j} \le P(1 \le i \le N,1 \le j \le K) 0Ai,jP(1iN,1jK)
1 ≤ C i ≤ 1 0 9 ( 1 ≤ i ≤ N ) 1 \le C_i \le 10^9(1 \le i \le N) 1Ci109(1iN)
All input values are integers.

Input

The input is given from Standard Input in the following format:

N N N K K K P P P
C 1 C_1 C1 A 1 , 1 A_{1,1} A1,1 A 1 , 2 A_{1,2} A1,2 … \dots A 1 , K A_{1,K} A1,K
C 2 C_2 C2 A 2 , 1 A_{2,1} A2,1 A 2 , 2 A_{2,2} A2,2 … \dots A 2 , K A_{2,K} A2,K
… \dots
C N C_N CN A N , 1 A_{N,1} AN,1 A N , 2 A_{N,2} AN,2 … \dots A N , K A_{N,K} AN,K

Output

If AtCoder Inc. can achieve its goal, print the minimum total cost required to achieve the goal; otherwise, print -1.

Sample Input 1
4 3 5
5 3 0 2
3 1 2 3
3 2 4 0
1 0 1 4
Sample Output 1
9

If you execute the first, third, and fourth development plans, each parameter will be 3 + 2 + 0 = 5 , 0 + 4 + 1 = 5 , 2 + 0 + 4 = 6 3+2+0=5,0+4+1=5,2+0+4=6 3+2+0=5,0+4+1=5,2+0+4=6, all of which are at least 5 5 5, so the goal is achieved. The total cost in this case is 5 + 3 + 1 = 9 5 + 3 + 1 = 9 5+3+1=9.
It is impossible to achieve the goal at a total cost of 8 8 8 or less. Thus, the answer is 9 9 9.

Sample Input 2
7 3 5
85 1 0 1
37 1 1 0
38 2 0 0
45 0 2 2
67 1 1 0
12 2 2 0
94 2 2 1
Sample Output 2
-1

You cannot achieve the goal no matter what you do. Thus, print -1.


Solution

一道动态规划 Dynamic Programming题目。
这里讲一下考场上的奇葩作法:

  1. 眺望到 A i , j ≤ P ≤ 5 A_{i,j}\le P\le5 Ai,jP5,突发奇想,设 F i , a , b , c , d , e F_{i,a,b,c,d,e} Fi,a,b,c,d,e 分别代表第 i i i 个产品的参数值
  2. 想到可以如下转移: F i , min ⁡ ( P , a + A i , 1 ) , min ⁡ ( P , b + A i , 2 ) , min ⁡ ( P , c + A i , 3 ) , min ⁡ ( P , d + A i , 4 ) , min ⁡ ( P , e + A i , 5 ) = min ⁡ ( 本身 , F j , a , b , c , d , e ) F_{i,\min(P,a+A_{i,1}),\min(P,b+A_{i,2}),\min(P,c+A_{i,3}),\min(P,d+A_{i,4}),\min(P,e+A_{i,5})}=\min(本身,F_{j,a,b,c,d,e}) Fi,min(P,a+Ai,1),min(P,b+Ai,2),min(P,c+Ai,3),min(P,d+Ai,4),min(P,e+Ai,5)=min(本身,Fj,a,b,c,d,e),就是说选了第 i i i 个产品,那么对于每一个参数就会增长这些值,而状态 i i i,可以由状态 j j j 转移而来( j < i j< i j<i),注意不是 i − 1 i-1 i1,如果写为 i − 1 i-1 i1 会漏掉许多状态。
  3. 最后是输出,这里诞生了奇葩的想法,由于 K = 1 K=1 K=1 的时候有一个参数, K = 2 K=2 K=2 的时候有两个参数, … \dots 那么,我们可以分别处理: K = 1 K=1 K=1时,是 max ⁡ i = 1 N ( F i , P , 0 , 0 , 0 , 0 ) \max_{i=1}^N(F_{i,P,0,0,0,0}) maxi=1N(Fi,P,0,0,0,0),因为后面不需考虑所以用 0 0 0 就行; K = 2 K=2 K=2时,是 max ⁡ i = 1 N ( F i , P , P , 0 , 0 , 0 ) \max_{i=1}^N(F_{i,P,P,0,0,0}) maxi=1N(Fi,P,P,0,0,0),以此类推 … \dots
    注意:一定要取 max ⁡ \max max,要不会吃好几发 WA \colorbox{orange}{\color{white}{WA}} WA!直接掉大分(哭

Code

#include <bits/stdc++.h>
#define int long long

using namespace std;

int N, K, P;
int A[101][6], C[101];
int F[101][6][6][6][6][6];

signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    
    cin >> N >> K >> P;
    
	for (int i = 1; i <= N; i ++)
	{
		cin >> C[i];
		for (int j = 1; j <= K; j ++)
			cin >> A[i][j];
	}
	
	memset(F, 0x3f, sizeof F);
	for (int i = 0; i <= N; i ++)
		F[i][0][0][0][0][0] = 0;
	for (int i = 1; i <= N; i ++)
		for (int j = 0; j < i; j ++)
			for (int a = 0; a <= P; a ++)
				for (int b = 0; b <= P; b ++)
					for (int c = 0; c <= P; c ++)
						for (int d = 0; d <= P; d ++)
							for (int e = 0; e <= P; e ++)
							{
								int &Tmp = F[i][min(P, a + A[i][1])][min(P, b + A[i][2])][min(P, c + A[i][3])][min(P, d + A[i][4])][min(P, e + A[i][5])];
								Tmp = min(Tmp, F[j][a][b][c][d][e] + C[i]);
							}
						
	if (K == 1)
	{
		int T = F[N][P][0][0][0][0];
		for (int i = 1; i <= N; i ++)
			T = min(T, F[i][P][0][0][0][0]);
		if (T > 1e16) cout << -1 << endl;
		else cout << T << endl;
	}
	if (K == 2)
	{
		int T = F[N][P][P][0][0][0];
		for (int i = 1; i <= N; i ++)
			T = min(T, F[i][P][P][0][0][0]);
		if (T > 1e16) cout << -1 << endl;
		else cout << T << endl;
	}
	if (K == 3)
	{
		int T = F[N][P][P][P][0][0];
		for (int i = 1; i <= N; i ++)
			T = min(T, F[i][P][P][P][0][0]);
		if (T > 1e16) cout << -1 << endl;
		else cout << T << endl;
	}
	if (K == 4)
	{
		int T = F[N][P][P][P][P][0];
		for (int i = 1; i <= N; i ++)
			T = min(T, F[i][P][P][P][P][0]);
		if (T > 1e16) cout << -1 << endl;
		else cout << T << endl;
	}
	if (K == 5)
	{
		int T = F[N][P][P][P][P][P];
		for (int i = 1; i <= N; i ++)
			T = min(T, F[i][P][P][P][P][P]);
		if (T > 1e16) cout << -1 << endl;
		else cout << T << endl;
	}

	return 0;
}

F - Vacation Query

Description

Problem Statement

You are given a string S S S of length N N N consisting of 0 and 1. Let S i S_i Si denote the i i i-th character of S S S.
Process Q Q Q queries in the order they are given.

Each query is represented by a tuple of three integers ( c , L , R ) (c, L, R) (c,L,R), where c c c represents the type of the query.
When c = 1 c=1 c=1: For each integer i i i such that L ≤ i ≤ R L \leq i \leq R LiR, if S i S_i Si is 1, change it to 0; if it is 0, change it to 1.
When c = 2 c=2 c=2: Let T T T be the string obtained by extracting the L L L-th through R R R-th characters of S S S. Print the maximum number of consecutive 1s in T T T.

Constraints

1 ≤ N ≤ 5 × 1 0 5 1 \leq N \leq 5 \times 10^5 1N5×105
1 ≤ Q ≤ 1 0 5 1 \leq Q \leq 10^5 1Q105
S S S is a string of length N N N consisting of 0 and 1.
c ∈ { 1 , 2 } c \in \lbrace 1, 2 \rbrace c{1,2}
1 ≤ L ≤ R ≤ N 1 \leq L \leq R \leq N 1LRN
N N N, Q Q Q, c c c, L L L, and R R R are all integers.

Input

The input is given from Standard Input in the following format, where q u e r y i \mathrm{query}_i queryi represents the i i i-th query:

N N N Q Q Q
S S S
q u e r y 1 \mathrm{query}_1 query1
q u e r y 2 \mathrm{query}_2 query2
⋮ \vdots
q u e r y Q \mathrm{query}_Q queryQ

Each query is given in the following format:

c c c L L L R R R

Output

Let k k k be the number of queries with c = 2 c=2 c=2. Print k k k lines.

The i i i-th line should contain the answer to the i i i-th query with c = 2 c=2 c=2.

Sample Input 1
7 6
1101110
2 1 7
2 2 4
1 3 6
2 5 6
1 4 7
2 1 7
Sample Output 1
3
1
0
7

The queries are processed as follows.
Initially, S = S= S= 1101110.
For the first query, T = T = T= 1101110. The longest sequence of consecutive 1s in T T T is 111 from the 4 4 4-th character to 6 6 6-th character, so the answer is 3 3 3.
For the second query, T = T = T= 101. The longest sequence of consecutive 1s in T T T is 1 at the 1 1 1-st or 3 3 3-rd character, so the answer is 1 1 1.
For the third query, the operation changes S S S to 1110000.
For the fourth query, T = T = T= 00. T T T does not contain 1, so the answer is 0 0 0.
For the fifth query, the operation changes S S S to 1111111.
For the sixth query, T = T = T= 1111111. The longest sequence of consecutive 1s in T T T is 1111111 from the 1 1 1-st to 7 7 7-th characters, so the answer is 7 7 7.


Solution

貌似是 线段树 经典题,场上没搞出来,(后悔

这题无疑两个操作:

  1. 区间翻转
  2. 最长连续 1 1 1 的个数

考虑线段树内存储哪些信息,建议先做一下:P4513 小白逛公园P6492 [COCI2010-2011#6] STEP

做完这两道题,相信大家就知道答案了:

  1. 左右端点( l , r l,r l,r)
  2. 从左边开始连续 1 1 1 的个数( L 1 L_1 L1),右边开始连续 1 1 1 的个数( R 1 R_1 R1)
  3. 这段区间的最长连续 1 1 1 的个数( L e n 1 Len_1 Len1)。

P u s h u p \mathrm{Pushup} Pushup 操作:

  1. 处理左边连续 1 1 1 的个数:如果左子树全是 1 1 1,那么就是 左子树大小 + 右子树 L 1 左子树大小+右子树L_1 左子树大小+右子树L1,反之就是 左子树 L 1 左子树L_1 左子树L1
  2. 处理右边连续 1 1 1 的个数:与上面类似
  3. 处理最长连续 1 1 1 的个数: max ⁡ ( max ⁡ ( 左子树 L e n 1 , 右子树 L e n 1 ) , 左子树 R 1 + 右子树 L 1 ) \max(\max(左子树Len_1,右子树Len_1),左子树R_1+右子树L_1) max(max(左子树Len1,右子树Len1),左子树R1+右子树L1),第二种情况是左右拼接到一起。

这样,只是求出了最长连续 1 1 1 的个数,还不支持翻转:
考虑如何处理翻转,我们会发现其实就是最长连续的 1 1 1,变成了最长连续的 0 0 0。所以我们线段数还要处理最长连续的 0 0 0,这样我们再仿照上面的操作进行一遍就可以切掉这道题了。

时间有限,写的可能简略,如有不懂 一定 要问我呦!

Code(细节较多,写起来要注意)

#include <bits/stdc++.h>
#define int long long

using namespace std;

const int SIZE = 5e5 + 10;

int N, Q;
int A[SIZE];
struct Segment
{
	int l, r;
	int L0, L1, R0, R1;
	int Len0, Len1;
	int Swap;
}Tree[SIZE * 4];

void Pushup(int u)
{
	if (Tree[u << 1].r - Tree[u << 1].l + 1 == Tree[u << 1].Len0)
		Tree[u].L0 = Tree[u << 1].Len0 + Tree[u << 1 | 1].L0;
	else
		Tree[u].L0 = Tree[u << 1].L0;
	if (Tree[u << 1 | 1].r - Tree[u << 1 | 1].l + 1 == Tree[u << 1 | 1].Len0)
		Tree[u].R0 = Tree[u << 1 | 1].Len0 + Tree[u << 1].R0;
	else
		Tree[u].R0 = Tree[u << 1 | 1].R0;
	
	if (Tree[u << 1].r - Tree[u << 1].l + 1 == Tree[u << 1].Len1)
		Tree[u].L1 = Tree[u << 1].Len1 + Tree[u << 1 | 1].L1;
	else
		Tree[u].L1 = Tree[u << 1].L1;
	if (Tree[u << 1 | 1].r - Tree[u << 1 | 1].l + 1 == Tree[u << 1 | 1].Len1)
		Tree[u].R1 = Tree[u << 1 | 1].Len1 + Tree[u << 1].R1;
	else
		Tree[u].R1 = Tree[u << 1 | 1].R1;
	
	Tree[u].Len0 = max(max(Tree[u << 1].Len0, Tree[u << 1 | 1].Len0), Tree[u << 1].R0 + Tree[u << 1 | 1].L0);
	Tree[u].Len1 = max(max(Tree[u << 1].Len1, Tree[u << 1 | 1].Len1), Tree[u << 1].R1 + Tree[u << 1 | 1].L1);
}

void Pushdown(int u)
{
	if (Tree[u].Swap != 0)
	{
		swap(Tree[u << 1].L0, Tree[u << 1].L1), swap(Tree[u << 1].R0, Tree[u << 1].R1);
		swap(Tree[u << 1].Len0, Tree[u << 1].Len1);
		Tree[u << 1].Swap ^= 1;//这里要注意如果本来要翻转,就不要再进行翻转了。
		swap(Tree[u << 1 | 1].L0, Tree[u << 1 | 1].L1), swap(Tree[u << 1 | 1].R0, Tree[u << 1 | 1].R1);
		swap(Tree[u << 1 | 1].Len0, Tree[u << 1 | 1].Len1);
		Tree[u << 1 | 1].Swap ^= 1;//这里要注意如果本来要翻转,就不要再进行翻转了。
		Tree[u].Swap = 0;
	}
}

void Build(int u, int l, int r)
{
	if (l == r)
	{
		Tree[u] = {l, l, !A[l], A[l], !A[l], A[l], !A[l], A[l]};
		return;
	}
	
	Tree[u] = {l, r};
	int mid = l + r >> 1;
	Build(u << 1, l, mid), Build(u << 1 | 1, mid + 1, r);
	Pushup(u);
}

void Modify(int u, int l, int r)
{
	if (Tree[u].l >= l && Tree[u].r <= r)
	{
		swap(Tree[u].L0, Tree[u].L1), swap(Tree[u].R0, Tree[u].R1);
		swap(Tree[u].Len0, Tree[u].Len1);
		Tree[u].Swap ^= 1; //这里要注意如果本来要翻转,就不要再进行翻转了。
		return;
	}
	
	Pushdown(u);
	int mid = Tree[u].l + Tree[u].r >> 1;
	if (mid >= l) Modify(u << 1, l, r);
	if (mid < r) Modify(u << 1 | 1, l, r);
	Pushup(u);
}

Segment Query(int u, int l, int r)
{
	if (Tree[u].l >= l && Tree[u].r <= r)
		return Tree[u];
	
	Pushdown(u);
	int mid = Tree[u].l + Tree[u].r >> 1;
	if (mid >= l && mid < r)
	{
		Segment Left = Query(u << 1, l, r), Right = Query(u << 1 | 1, l, r);
		Pushup(u);
		Segment Tmp;
		Tmp.l = Left.l, Tmp.r = Right.r;
		if (Left.L1 == Left.r - Left.l + 1)
			Tmp.L1 = Left.L1 + Right.L1;
		Tmp.L1 = max(Tmp.L1, Left.L1);
		
		if (Right.r - Right.l + 1 == Right.Len1)
			Tmp.R1 = Right.Len1 + Left.R1;
		Tmp.R1 = max(Tmp.R1, Right.R1);
		
		Tmp.Len1 = max(max(Left.Len1, Right.Len1), Left.R1 + Right.L1);
		
		return Tmp;
	}
	else if (mid >= l)
		return Query(u << 1, l, r);
	else
		return Query(u << 1 | 1, l, r);
}

signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    
    cin >> N >> Q;
    
    char x;
    for (int i = 1; i <= N; i ++)
    	cin >> x, A[i] = x & 1;
    	
    Build(1, 1, N);
    	
    while (Q --)
    {
    	int op, l, r;
    	cin >> op >> l >> r;
    	
    	if (op == 1)
    		Modify(1, l, r);
    	else
    		cout << Query(1, l, r).Len1 << endl;
	}

	return 0;
}

未简化代码,大家见谅~~~


最后,祝大家早日:在这里插入图片描述

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值