|
||||||||||
Color itTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 4194 Accepted Submission(s): 1154 Problem Description Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy painting, Little D asks you to write a program to maintain following operations. The specific format of these operations is as follows. $0$ : clear all the points. $1$ $x$ $y$ $c$ : add a point which color is $c$ at point $(x,y)$. $2$ $x$ $y_1$ $y_2$ : count how many different colors in the square $(1,y1)$ and $(x,y2)$. That is to say, if there is a point $(a,b)$ colored $c$, that $1 \leq a \leq x$ and $y_1 \leq b \leq y_2$, then the color $c$ should be counted. $3$ : exit. Input The input contains many lines. Each line contains a operation. It may be '0', '1 x y c' ( $1\leq x,y\leq 10^6,0\leq c \leq 50$ ), '2 x y1 y2' ($1\leq x,y_1,y_2\leq 10^6$ ) or '3'. $x,y,c,y1,y2$ are all integers. Assume the last operation is 3 and it appears only once. There are at most $150000$ continuous operations of operation 1 and operation 2. There are at most $10$ operation 0. Output For each operation 2, output an integer means the answer . Sample Input
Sample Output
Source | ||||||||||
|