2499 - I2P(II)2022_Kuo_lab2 Scoreboard

Time

2022/04/12 13:20:00 2022/04/12 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13231 cheat sheet
13454 Circular String
13472 KYてぇてぇ — Birthday Present(class + reverse)

13231 - cheat sheet   

Description

string:

Strings are objects that represent sequences of characters.

#include <string>

beginReturn iterator to beginning

end: Return iterator to end

rbegin: Return reverse iterator to reverse beginning

rend: Return reverse iterator to reverse end

empty: Test whether container is empty

clear: Clear string

length: Return length of string

substr: Generate substring

push_back: Append character to string

pop_back: Delete last character 

 

set:

Sets are containers that store unique elements following a specific order.

#include <set>

begin: Return iterator to beginning

end: Return iterator to end

rbegin: Return reverse iterator to reverse beginning

rend: Return reverse iterator to reverse end

empty: Test whether container is empty

clear: Clear content

size: Return container size

insert: Insert element

erase: Erase elements

find: Get iterator to element

 

list:

Lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iteration in both directions.

#include <list>

begin: Return iterator to beginning

end: Return iterator to end

rbegin: Return reverse iterator to reverse beginning

rend: Return reverse iterator to reverse end

empty: Test whether container is empty

clear: Clear content

size: Return container size

front: Access first element

back: Access last element

emplace_front: Construct and insert element at beginning

emplace_back: Construct and insert element at the end

push_front: Insert element at beginning

push_back: Insert element at the end

pop_front: Delete first element 

pop_back: Delete last element

 

vector:

Vectors are sequence containers representing arrays that can change in size.

#include <vector>

begin: Return iterator to beginning

end: Return iterator to end

rbegin: Return reverse iterator to reverse beginning

rend: Return reverse iterator to reverse end

empty: Test whether container is empty

clear: Clear content

size: Return container size

front: Access first element

back: Access last element

emplace_back: Construct and insert element at the end

push_back: Add element at the end

pop_back: Delete last element

 

queue:

#include <queue>

empty: Test whether container is empty

size: Return container size

push: Insert element

pop: remove next element

front: Access next element

 

stack:

#include <stack>

empty: Test whether container is empty

size: Return container size

top: Access next element

push: Insert element

pop: remove next element

 

map:

#include <map>

begin: Return iterator to beginning

end: Return iterator to end

rbegin: Return reverse iterator to reverse beginning

rend: Return reverse iterator to reverse end

empty: Test whether container is empty

clear: Clear content

insert: Insert Element

erase: Erase element

count : Count elements with a specific key

find: Get iterator to element

operator[]: Access element

lower_bound: Return iterator to lower bound

upper_bound: Return iterator to upper bound

 

deque:

#include <deque>

push_front: Insert element at beginning

push_back: Insert element at the end

pop_front: Delete first element 

pop_back: Delete last element

empty: Test whether container is empty

size: Return container size

insert: Insert element

erase: Erase element

operator []: Access element

front: Access first element

back: Access last element

clear: Clear the container

 

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




13454 - Circular String   

Description

Mrs. White-Cloud is a music teacher in a high school. She loathes being called "White Cloud" by her students drastically. Once she hears anybody saying "White Cloud", Mrs. White-Cloud always comes to exceedingly furious and ridiculous. Since Mrs. White-Cloud is so skeptical, the students try to avoid mentioning the ``She-Who-Must-Not-Be-Named" keyword cautiously. They developed a method: to encode words by circular shifting the word to the lexicographically smallest one. Please help them to encode their words.

The lexicographical order is a binray relation of two strings to compare the first non-identical character if both strings are not prefix to the other, otherwise compare their lengths. For instance, "qaz" \(<\) "qwerty".

The circular shift of a string \(s\) could be deem as append a substring starting from the front of \(s\) to the remaing of \(s\). For instance, "qaz", "azq" and "zqa" are all circular shifts of each one.

Input

There is a string \(s\) containing only lower case English letters, where \(|s| < 5000\).

Output

Please print out the lexicographically smallest string among all circular shift of \(s\). Remember to put a newline character at the end of line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13472 - KYてぇてぇ — Birthday Present(class + reverse)   

Description

Kuo-chan is given a sequence A and a constant K as his birthday present from Yang-chan.

Kuo-chan is allowed to perfrom the following operation:

  1. push x — push x to the tail of A
  2. pop — remove the median value of A (the median value of A is A[ (|A|+1)/2 ], with index start at 1)
  3. programming tanoshi — for every element a in A, assign a % K to a
  4. reverse — reverse the whole A, the head becomes the tail and the tail becomes the head

 

Whenever performing pop operation, the length of A is guaranteed to be odd, hence A won't be empty.

 

For example, if A = [4, 3, 5], K = 2

push 11 ► A = [4, 3, 5, 11]

reverse ► A = [11, 5, 3, 4]

push 7 ► A = [11, 5, 3, 4, 7]

pop ► A = [11, 5, 4, 7]

programming tanoshi ► A = [1, 1, 0, 1] 

 

Yang-chan is curious about what A is after Kuo-chan performs some operations to it.

Help him find it out!

 

(Remember to include function.h in your function.cpp file.)

 

Input

The first line contains three integers N K Q — the length of A, the constant Yang-chan gives Kuo-chan, the number of operations Kuo-chan performs.

The second line contains N integers a1, a2, ..., aN (1 <= ai <= N) — the elements of A. 

Each of the next Q lines describes the operations. Each line is one of three types:

  1. push x (1 <= x <= 10000)
  2. pop
  3. programming tanoshi
  4. reverse

 

Different testcases have different constraints.

  1. N <= 103, Q <= 2N, K <= 4000, operations: {pop, push}
  2. N <= 103, Q <= 2N, K <= 4000, operations: {pop, push, programming tanoshi}
  3. N <= 105, Q <= 2N, K <= 4000, operations: {pop, push}
  4. N <= 105, Q <= 2N, K <= 4000, operations: {pop, push, programming tanoshi}
  5. N <= 105, Q <= 3N, K <= 4000, operations: {pop, push, programming tanoshi, reverse}
  6. N <= 105, Q <= 3N, K <= 4000, operations: {pop, push, programming tanoshi, reverse}

 

Output

You should print one line containing the elements of A after the operations. For 1 <= i <= |A|, the i-th number should be A[ i ].

Sample Input  Download

Sample Output  Download

Partial Judge Code

13472.cpp

Partial Judge Header

13472.h

Tags




Discuss