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:||0.268722 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, D, PERL, FORT, ADA, ASM, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, TCL, PERL6, CLOJ, FS|
Fetching successful submissions