Multiples of 3Problem code: MULTQ3 |
All submissions for this problem are available.
There are N numbers a[0],a[1]..a[N - 1]. Initally all are 0. You have to perform two types of operations :
1) Increase the numbers between indices A and B by 1. This is represented by the command "0 A B"
2) Answer how many numbers between indices A and B are divisible by 3. This is represented by the command "1 A B".
Input :
The first line contains two integers, N and Q. Each of the next Q lines are either of the form "0 A B" or "1 A B" as mentioned above.
Output :
Output 1 line for each of the queries of the form "1 A B" containing the required answer for the corresponding query.
Sample Input : 4 7 1 0 3 0 1 2 0 1 3 1 0 0 0 0 3 1 3 3 1 0 3
Sample Output : 4 1 0 2
Constraints : 1 <= N <= 100000 1 <= Q <= 100000 0 <= A <= B <= N - 1
| Author: | syco |
| Date Added: | 11-04-2010 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
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.

Fetching successful submissions

@Admins: Please have a look
@Admins: Please have a look at my submission. It is giving me correct result for every test case,, but here it is showing wrong answer.. i can't figure out what's wrong with my code. Please help!
Somebody please help! What's
Somebody please help! What's wrong with my code, why it is giving wrong answer?? I can't check it more.., somebody please help
its giving tle error . but in
its giving tle error . but in my pc its giving output in microsecs
smebody plz help
smebody plz help
#include<iostream>using
dont understand by i am getting runtime error..
please any help me
It seems to be working fine
It seems to be working fine mate.. I am not getting any runtime error
Try this int
Try this
int a[100000]={0},i,c,n,q,x,y,z;
I think you won't get the runtime error
Anyone help me..!!! This code
Is there anyway by which we
No, there isn't. The judging
Getting run time error even
I'm submitting the code in
Fenwick tree?
someone help me ...i can't
I really don't get it: The
@Admins: Please check this
@admin please could you check
The code is working fine on
this is my solution in python
Here I see time limit of 1
How is this different from
@admin what is the actual