题面挂了
查看原帖
题面挂了
540226
fengziyi楼主2023/7/5 20:57

题目描述

The Alphabetic Rope is now available in the market.

The Alphabetic Rope consists of alphabeticcharacters in each stripe which looks like string.

You are given an Alphabetic rope consists of lowercase alphabetic characters only,you have to performsome operations on rope and answers some queries on it and Time is increases by 1.

Initial time is 0 and Queries are of 4 types:

1 X Y : Cut the rope segment from X to Y and join at the front of rope.
2 X Y : Cut the rope segment from X to Y and join at the back of rope.
3 Y: Print on a new line the Alphabet on Yth position of current rope.
4 X Y: Print on a new line the Alphabet on Yth position of rope configuration at Xth time.

输入格式

There is only one input. Input begins with single line giving Alphabetic Rope as a string S.
Next line containg Q, follows Q lines giving Queries as mentioned above. (Index used are 0-based)

输出格式

For each query of type 3 and type 4, Print a single character in a new line.

1≤∣S∣≤100001\le |S|\le 10000. (Length of string) 1≤Q≤100001\le Q\le 10000. (Total Queries)

样例 #1

样例输入 #1

gautambishal
5
3 0
2 0 5
3 1
4 0 0
4 3 0

样例输出 #1

g
i
g
b
2023/7/5 20:57
加载中...