2114 - I2P(I)2020_Yang_HW4 Scoreboard

Time

2020/10/06 20:31:00 2020/10/13 18:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11593 Mexican Wave
12009 Caesar salad
12891 Longest Row Vector

11593 - Mexican Wave   

Description

James, a pro photographer, recently went to a baseball game. He was very interested in Mexican wave, so he decided to take some photos of it.

Image that there are n spectators in the stadium, labelled from 1 to n. The maximum length of the wave is m. The spectators start the Mexican wave at time 0.

 

- At time 1, the first spectator stands.
- At time 2, the second spectator stands.
- ...
- At time m, the m-th spectator stands.
- At time m + 1, the (m + 1)-th spectator stands and the first spectator sits.
- At time m + 2, the (m + 2)-th spectator stands and the second spectator sits.
- ...
- At time n, the n-th spectator stands and the (n - m)-th spectator sits.
- At time n + 1, the (n + 1 - m)-th spectator sits.
- ...
- At time n + m, the n-th spectator sits.

 

Now, James prints out T pictures he took and wants to play a game with you. For each picture, James will give you n, m, and the time t he took the picture. Can you predict how will picture looks like?

If you win the game, maybe James will teach you some tips about shooting an astonishing picture.

Input


The first line contains one integer number T, representing the numbers of photos.

The next T lines contain three integers n, m, t, representing the number of spectators, the maximum length of the wave, and the time James took the picture.

1 <= T <= 100
1 <= m <= n <= 100
0 <= t <= 100

Output

For each picture please output a line contains n characters, representing the states of the n spectators. If a spectator is sitting, please print '-', otherwise please print '^'. You can find out more information in sample output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12009 - Caesar salad   

Description

Caesar wants to eat salad, but nobody sells salad within his country. Thus, he decides to write a letter to the businessmen outside his country. But to secure his message, he has to encrypt the content of his letter.

The encrypt rule is as follow: For each English character inside his letter, shift it with a fixed number n in positive/negative direction.

For example,

  • n = 2, then "IJK" will become "KLM"
  • n = 3, then "IJK" will become "LMN"
  • n = -2, then "AJK" will become "YHI"
    • We do the shifting in a cyclic manner, that is, perform left shift 1 on "A" will become "Z"; right shift 2 on "Y" will become "A"

Actually, this encryption is the well-known Caesar chiper.

Input

Input consists of three UPPERCASE English characters and an integer nseperated by a whitespace character.

The three uppercase English characters is the Caesar's message, n is the shift amount mentioned above (positive for right shift, negative for left shift).

It is guaranteed that -2147483648 <= n <= 2147483647.

Output

Print Caesar's message after encryption (three UPPERCASE English character).

Remember to print a '\n' at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12891 - Longest Row Vector   

Description

A matrix can be regarded as ordered sequence of row vectors.

Let’s define the length of vector, and 2 kinds of operations for matrix.

  • length of vector v: Euclidean norm, which means | v | = sqrt( ∑ (vi)2)
  • switch (i, j): swap the i-th row with j-th row, which means ri ⟷ rj
  • add (i,j): add j-th row to i-th row, which means ri ← ri + rj

Given one m x n matrix A, and K operations.
Your task is to find the longest row vector v in A after K operations.

If there’re more than one longest row vector, print the one with smaller row index.

Input

Three numbers m, n, K on the first line.
For each of following m lines, there’s a row vector ri of matrix A.
Every row vector consists of n numbers.
The next K lines contains one operation per line.
Each operation is one of “0 i j” or “1 i j”, denoting the operation switch (i,j) and add (i,j) respectively.

It’s guaranteed that:

  • 1 ≤ m, n ≤ 1000
  • 0 ≤ K ≤ 1000
  • 0 ≤ i ≤ m and 0 ≤ j ≤ n
  • -100 ≤ Each element in A ≤ 100

Output

Print the longest row vector after several operations in one line.
If there’re more than one longest row vector, print the one with smaller row index.
Note that there’s “\n” on the end of lines.


Explaination for Sample

Sample Input  Download

Sample Output  Download

Tags




Discuss