2098 - I2P(II)2020_Chen_week2_HW Scoreboard

Time

2020/09/22 23:57:00 2020/09/29 23:59:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12237 TA's Heartfelt
12289 after rain
12367 Gey cool~

12237 - TA's Heartfelt   

Description

"Oh, no! The problem is so hard! No, no, no... Am I too stupid?"

"Hey, my code is right! Why do I always get a WA or TLE?"

"The method is difficult to understand, why are TAs always give us such a hard problem?"

"Did you heard that? I heard that the problem of the other professorss course is far more easier..." "Really? I should have chosen the other course..."

Yeah, we TA all know that it's hard for you to understand these new concepts. However, we do hope you to learn some knowledge that is important or useful. Such as "Prefix Sum", you can pre-calculate all the sum of (1,i) to get any sum of (i,j), which is far more faster than calculate the sum using for/while... right? 

What about gcd or fast power(快速冪)? I think all of you may learn the split phase division(輾轉相除法), so it should be not too hard to you guys to learn that, right? For the part of fpw(fast power), it's not too hard to realize how it works, which is also wonderful that we could calculate nm or the n-th Fibonacci number so fast, even without include<moon>!

We do hope you guys could enjoy learning these interesting concepts instead of just taking the course, getting an A/A+, and treat this course as a part of your 4.3 GPA. 

If you don't want to learn these extra knowledge, or you're too busy to learn, you can just submit a brute-force solution without using any of the concepts above, you can still pass 3-5 testcases(only if the method is right).

So now, we're going to have another question. Don't worry, you can get an AC by brute force (though that would be a little difficult).

You guys have learned IEEE floating point number, right? If you forget it, rewind it, please. Our problem won't become easier for you :(


  • You are given a IEEE-754 floating number with single precision(which is type "float" in C)
  • You are going to output every bit of the number, from the largest bit to the smallest bit (including every 0)
  • Note that scanf("%f", &x); will automatically parse scientific numbers into floating point number, so you don't have to implement this part.

Hint.1: You may solve this problem by using pointer tricks extremely easily. However, you can still solve this by using traditional way. :)

Hint.2: You may refer to this page to check the binary of a fp number.

Enjoy!

Input

The input contains multiple testcases, which means we'll input several floating point numbers, ended by EOF.

Note that there may be precision error due to the precision of floating point number. What we want you to output is the binary bits of the floating point number stored in C variable.

We recommand to use scanf as your input function.

You can take a look and observe the sample IO.

The range of the floating point number is -1020 ~ 1020.

Output

Output every bit of the floating point number. Remember to print a '\n' at the end of every output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12289 - after rain   

Description

 

After rain comes sunshine and rainbow.

5/17 is the International Day Against Homophobia, Transphobia and Biphobia(國際不再恐同日), which is also the day that legislative committees trial the special law about LGBT. They eventually pass a draft that fully in line with the referendum, which make Taiwan be the first Asia country that pass a law for LGBT.


Knuckles is on his way of finding his queen. When he arrived Taiwan and see a lot of rainbow flags, he wondered that these rainbow flags might be a clue of the location of his queen. He will give some operations about these flags, you are going to help him, or he'll spit on you.


  • There are colors on these flags. The colors include: "Red", "Orange", "Yellow", "Green", "Blue", "Purple", which are the color of rainbow.

  • Knuckles has a sequence of colors. Initially, the sequence is empty.

  • Knuckles has several operations: insert, erase1, erase2, reverse, show.

    • insert <color> <dest>: means insert <color> after the location of <dest>. For example, insert Yellow 5 means insert a "Yellow" after the 5-th location. If <dest> is larger than the length of the sequence, just regard it as the last location of the sequence.

    • erase1 <dest>: means erase the color locates at <dest>. For example, erase1 4 will erase the 4-th color in the sequence. If <dest> is larger than the length of the sequence, just regard it as the last location of the sequence.

    • erase2 <color>: means erase all <color> in the sequence. For example, erase2 Purple will erase all the "Purple" in the sequence. After the operation, There should be no "Purple" in the sequence.

    • reverse <dest1> <dest2>: means reverse the elements from <dest1> to <dest2>. If the order was originally {"Yellow", "Purple", "Blue"}, after reversing, the order should become {"Blue", "Purple", "Yellow"}. If <dest1> or <dest2> is larger than the length of the sequence, just regard it as the last location of the sequence.

    • show: show the sequence according to the order.

You are going to implement a linked list that support these operations. We have implemented show operation, what you have to do is to implement the remaining operations: insert, erase1, erase2, reverse.

If you have further questions, please reference to the sample I/O.

Input

The first line contains an integer n, indicates the number of operations.

There are n lines below. Each line contains one operations described above.

<color> will only appear the 6 colors described above.

insert: 0 <= <dest> <= 10000

erase1: 1 <= <dest> <= 10000

reverse: 1 <= <dest1>, <dest2> <= 10000

1 <= n <= 5000

Output

When show operation is called, you should output the correct sequence after operating.

Sample Input  Download

Sample Output  Download

Partial Judge Code

12289.c

Partial Judge Header

12289.h

Tags




Discuss




12367 - Gey cool~   

Description

A famous streamer once said: "Gey cool...gey...gey...gey... gey cool~". While this streamer playing his video games, you still need to finish your OJ test. The following is your problem.


You will have n numbers and q times of queries.

These n numbers are placed in an array which position starts from 1.

Each query includes two numbers a, b which indicate the range from position a to position b.

The sum of a range indicates the sum of numbers from position a to position b.

The rules to sum up all the numbers are as follow.

If a is bigger than b , you need to sum up the numbers from a to the end and also the part from start to b.(blue part)

If a is smaller than b you just need to sum up the numbers from a to b.(blue part)

If a is equal to b, than there's only one number, and the number will be the sum.(blue part)

Your task is finding the range from queries that has the maximum sum.

Print the range and it's value.

 

Note that the position starts from 1.

If you find multiple answers, you only need to answer the first one appear in the queries.

You can use prefix sum to solve this problem.

⠄⠄⠄⠄⠄⠄⠄
 ⠄⠄⠄⠄⠄⠄⠄⠈⠉⠁⠈⠉⠉⠙⠿⣿⣿⣿⣿⣿
 ⠄⠄⠄⠄⠄⠄⠄⠄⣀⣀⣀⠄⠄⠄⠄⠄⠹⣿⣿⣿
 ⠄⠄⠄⠄⠄⢐⣲⣿⣿⣯⠭⠉⠙⠲⣄⡀⠄⠈⢿⣿
 ⠐⠄⠄⠰⠒⠚⢩⣉⠼⡟⠙⠛⠿⡟⣤⡳⡀⠄⠄⢻
 ⠄⠄⢀⣀⣀⣢⣶⣿⣦⣭⣤⣭⣵⣶⣿⣿⣏⠄⠄⣿
 ⠄⣼⣿⣿⣿⡉⣿⣀⣽⣸⣿⣿⣿⣿⣿⣿⣿⡆⣀⣿
 ⢠⣿⣿⣿⠿⠟⠛⠻⢿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣼
 ⠄⣿⣿⣿⡆⠄⠄⠄⠄⠳⡈⣿⣿⣿⣿⣿⣿⣿⣿⣿
 ⠄⢹⣿⣿⡇⠄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
 ⠄⠄⢿⣿⣷⣨⣽⣭⢁⣡⣿⣿⠟⣩⣿⣿⣿⠿⠿⠟
 ⠄⠄⠈⡍⠻⣿⣿⣿⣿⠟⠋⢁⣼⠿⠋⠉⠄⠄⠄⠄
 ⠄⠄⠄⠈⠴⢬⣙⣛⡥⠴⠂⠄⠄⠄⠄⠄⠄⠄⠄⠄...
(the photo of the famous streamer)

Input

Input end with EOF.

Each testcase contains several lines.

First line contains two integer n(1<= n <= 2000000) and q(1<= q<=2000000)

Second line contains n integers. Each number ranged from 1~1000000000.

The following are q lines. Each line contain two integer a,b(1<= a,b <=n)

Testcases are divided by a blank line.

Output

For each testcases print the answer in the following format:

Max_range: (%d,%d); Value: %d

The first two integer means the two numbers which indicate the maximum range.

The last integer means the sum of this range.

Remember to print \n at the end of each output.

Sample Input  Download

Sample Output  Download

Tags




Discuss