# | Problem | Pass Rate (passed user / total user) |
---|---|---|
11628 | Spiral |
|
13633 | Indentation |
|
14023 | Esports player Penguin07 |
|
Description
SunMoon likes spiral(漩渦). On the N*N’s space, he starts moving into the left top corner, (0,0), and walking right for totally N steps (including the first movement into (0,0)). He then walks down for N-1 steps, then walks left for N-2 steps and then walks up for N-3 steps… until no more steps are possible. When he walks across that space, he will draw '#' on the floor. The others that he doesn’t pass will be ‘ ‘. Please tell SunMoon what the resulting spiral(漩渦) looks like.
Input
There is a positive number T(1 <= T <= 1000). It means that there are T numbers.
In next T lines, each line contains a positive number N(1 <= N <= 5000),which is the size of the space.
Output
Please show the resulting spiral(漩渦).
Note: The first step is to enter (0,0), and the second step is to enter (0,1)…and so on.
About the output format, please refer to sample output below, the download of sample output is not correct.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
You're now in a bad mood since you quarreled with your best friend.
Recently, your best friend keeps convince you that using semicolons for indentation is the best way to code in C. He claimed that semicolons are beautiful, so you'll be in a good mood if you put a lot of semicolons in your code. What's more, you'll never forget to add a semicolon at the end of the line anymore. You think that your friend is insane and you have a severe headache every time you read his code.
Therefore, you decide to get rid of this terrible habit for your friend: now your friend is taking a nap, and you are going to open his computer, find his code files, and turn all of his code to space indentation.
Given lines of compilable C code. Currently, the code is indented by semicolons, and now you want to rewrite this code using spaces for indentation.
In other words, you are going to do the following operations:
- For every single line, turned every prefix semicolon into spaces.
- Add a semicolon at the end of every single line, except for the lines mentioned below:
- Header file included. e.g. #include <stdio.h>
- A line that contains '{' at the very end of it.
- A line that contains only semicolons and a single '}' at the end.
It is guaranteed that there are no other situations that don't need a semicolon at the end of the line.
Input
Lines of compilable C code, terminated by EOF.
Output
The code using space for indentation.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Penguin07 is a professional esports player who excels in various games such as “Mobile Legends”, “League of Legends”, “PUBG”, “Fall Guys” and more.
However, his most exceptional game is called the “Counting Game”. In this game, it will provide you with a sequence A of length N and perform M operations with the following rules:
- Given an interval [L,R] and a number X, you are required to add X to all elements of the sequence A in this interval, i.e., Ai (L ≤ i ≤ R)
Please determine the modified sequence after M operations.
Can you, the smartest person in the world, defeat Penguin07 and become the ultimate professional esports player ?
Input
The first line will contain two positive integers, N and M, N is the length of the sequence and M is the number of operations.
The second line contains N integers A1, A2, … , AN, representing the elements of the sequence A.
The following M lines each contain three integers L, R, and X, indicating that you should add X to all elements within the interval [L,R].
Constraints:
- Test Cases 1 ~ 3: 1 ≤ N, M ≤ 103, −109 ≤ A1, A2, ... , AN, X ≤ 109, 1 ≤ L ≤ R ≤ N
- Test Cases 4 ~ 6: 1 ≤ N, M ≤ 106, −109 ≤ A1, A2, ... , AN, X ≤ 109, 1 ≤ L ≤ R ≤ N
Output
Please output N integers, representing the sequence A after performing M operations.
Do not include any spaces at the end of line.
Remember to print a ‘\n’ at the end of the output.
Sample IO Description
- The first operation: A = {2, 3, 3, 4}
- The second operation: A = {2, 5, 5, 4}
- The third operation: A = {2, 5, 9, 8}
So, after performing the three operations, the modified sequence A is: {2, 5, 9, 8}
Hint
A usual computer can run 109 basic operations (such as +, -, &, |) in 1 second. Although this depends on the judging server, this number serves as a good estimation for the running time of your code. Try to figure out how much operations your code needs to execute to finish all the computations (since not all operations in your code are basic operations, another estimate criterion is 108 operations (+, -, *, /, =, ...) in 1 second)!