1938 - I2P(II)2020_Lee_Lab1 Scoreboard

Time

2020/03/10 13:20:00 2020/03/10 15:20:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12606 Happy New Year
12612 Queries on a String
12676 Implement Linked List( Easy )

12606 - Happy New Year   

Description

Chinese New Year is coming.
Bob decides to say “Happy New Year” to his friends.
Bob and his friends reside on the same street.
We can view the street as a straight line, and the position of their houses as points on the straight line.

Bob is at his home at begining.
He wants to visit each of his friend at least once, and then go back to his home.
Because he is too lazy to move, can you help him to find out the minimun distance he should move?

Input

One integer N on the first line, denoting the number of Bob’s friends.
The second line contains N+1 distinct number x0,x1,x2,...,xn
x0 represents the position of Bob’s house.
x1,x2,...,xn represents the position of Bob’s friends.

It’s guaranteed that:

  • ≤ ≤ 2105
  • ≤ x≤ 109

Output

Print the minimun distance he should move in one line.
Remember ‘\n’ on the end of line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12612 - Queries on a String   

Description

Problem from Codeforces Education round 1

You are given a string s and should process m queries. Each query is described by two 1-based indices li, ri and integer ki. It means that you should cyclically shift the substring s[li... ri] ki times. The queries should be processed one after another in the order they are given.

One operation of a cyclic shift (rotation) is equivalent to moving the last character to the position of the first character and shifting all other characters one position to the right.

For example, if the string s is "abacaba" and the query is l1 = 3, r1 = 6, k1 = 1 then the answer is "abbacaa". If after that we would process the query l2 = 1, r2 = 4, k2 = 2 then we would get the string "baabcaa".

Input

The first line of the input contains the string s (1 ≤ |s| ≤ 10000) in its initial state, where |s| stands for the length of s. It contains only lowercase English letters.

Second line contains a single integer m (1 ≤ m ≤ 300) — the number of queries.

The i-th of the next m lines contains three integers li, ri and ki (1 ≤ li ≤ ri ≤ |s|, 1 ≤ ki ≤ 1000000) — the description of the i-th query.

Output

Print the resulting string s after processing all m queries.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12676 - Implement Linked List( Easy )   

Description

Given a link list structure named Node.

typedef struct _Node {
    int data;
    struct _Node *next;
} Node;

In this problem, you need to implement two operation for the linked list. 

func1: Node* createList(int *a, int size);

func2: void deleteElementByIdx(Node** head, int idx);

func1: using an array to build the link list

func2: delete the element by its index (begin from 0)

ex: origin linked list : [0, 1, 2, 3], when call the function deleteElementByIdx(&head, 0). the final linked list will be [1,2,3]

note that: if the idx out of range. you should ignore the delete operation

Input

T M

S1 .. SM

del0_idx

...

delT_idx

T: the number of command ( 0 < T <= 200)

M: the number of initial linked size (0 <= M <= 2000)

Si: the value of the initial array (0 <= Si <= 1000)

Output

Output the element in linked list whenever the operation be called. 

Sample Input  Download

Sample Output  Download

Partial Judge Code

12676.c

Partial Judge Header

12676.h

Tags




Discuss