All submissions for this problem are available.
Bob has n heap(s) of gravel (initially there are exactly c piece(s) in each). He wants to do m operation(s) with that heaps, each maybe:
- adding pieces of gravel onto the heaps from u to v, exactly k pieces for each,
- or querying "how many pieces of gravel are there in the heap p now?".
Help Bob do operations of the second type.
- The first line contains the integers n,m,c, respectively.
- m following lines, each forms:
- S u v k to describe an operation of the first type.
- Q p to describe an operation of the second type.
(Each integer on a same line, or between the characters S, Q and the integers is separated by at least one space character)
For each operation of the second type, output (on a single line) an integer answering to the respective query (follows the respective Input order).
7 5 0 Q 7 S 1 7 1 Q 3 S 1 3 1 Q 3
0 1 2
- 0<m≤250 000
|Tags||anhdq april11 bit easy|
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, C, C99 strict, CLOJ, CPP 4.3.2, CPP 4.9.2, CS2, D, FORT, FS, GO, ICON, JAVA, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PYTH, PYTH 3.4, RUBY, SCM guile, SCM qobi, ST, TCL|
Fetching successful submissions