|
||||||||||
Paint The WallTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5166 Accepted Submission(s): 1320 Problem Description As a amateur artist, Xenocide loves painting the wall. The wall can be considered as a line consisting of n nodes. Each node has its own color. Xenocide spends all day in front of the wall. Sometimes, he paints some consecutive nodes so that these nodes have the same color. When he feels tired, he focuses on a particular color and counts the number of nodes that have this color within a given interval. Now Xenocide is tired of counting, so he turns to you for help. Input The input consists of several test cases. The first line of each test case contains two integer n, m(1<=n, m<=100000) indicating the length of the wall and the number of queries. The following line contains N integers which describe the original color of every position. Then m lines follow. Each line contains 4 non-negative integers a, l, r, z(1<=a<=2, 0<=l<=r<n ,0<=z<231). a = 1 indicates that Xenocide paints nodes between l and r and the resulting color is z. a = 2 indicates that Xenocide wants to know how many nodes between l and r have the color z. Output Print the corresponding answer for each queries. Sample Input
Sample Output
Source | ||||||||||
|