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 |
| Tester: | anshuman_singh |
| Editorial | http://discuss.codechef.com/problems/MULTQ3 |
| 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, FORT, FS, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, 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
Fetching successful submissions
HELP
|
If you are still having problems, see a sample solution here. |

Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach.
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.
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
??? ideone is shwng 0.2
#include int main() { long
@admin - can you suggest, how