Sines Sum QueriesProblem code: SINSUMQ |
All submissions for this problem are available.
You are given a sequence of integers A0, A1, ..., AN-1. Initially Ai=i for all i. You need to perform some strange queries with it. Each query has the form "L R D" where 0 <= L <= R < N and D is an integer. If D=0 then you need to find the sum of sines of the numbers AL, AL+1, ..., AR that is sin AL + ... + sin AR. Otherwise you need to add D to the numbers AL, AL+1, ..., AR.
Input
The first line contains two positive integers N and Q. Here, N <= 109 is the length of the initial sequence and Q <= 100000 is the number of queries you need to perform with it. The next Q lines describe queries, one per line. The i'th such line contains three integers L, R and D. Here 0 <= L <= R < N and -10000 <= D <= 10000.
Output
The output consists of answers for all queries where D=0. For each such query you must produce a line with the corresponding sines sum. Answers within an absolute error of 10-6 will be accepted.
Example
Input: 5 6 0 4 0 0 2 1 3 4 2 0 4 0 2 3 -1 1 4 0 Output: 1.1350859 0.65354865 0.782376860
| Date: | 2011-06-08 |
| Time limit: | 7s |
| Source limit: | 50000B |
| Languages: | All |
Comments
Loading Comments...
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
Loading Submissions...RECENT ACTIVITY FOR THIS PROBLEM:
Loading Recent Activity...HELP
Program should read from standard input and write to standard output.
After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.
