F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

digger

Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 740    Accepted Submission(s): 222


Problem Description
AFa have n mountains. These mountains in a line¡£All of mountains have same height initially. Every day , AFa would request ZJiaQ to cut some mountains or put stones in some mountains. And request ZJiaQ report how many mountains belong to ¡°high mountain line¡±
when all of mountains in a range have same height, and higher than the nearest mountain in left and the nearest mountain in right. the range of mountains called ¡°high mountain line¡±
of course ,the mountain in the most left and most right can¡¯t be one of ¡°high mountain line¡±
 

Input
  There are multiply case
In each case, the first line contains 3 integers: n(1<=n<=10^9) , q ( 1 <= q <= 50000), r(0 <= r<= 1000 ).n is the number of mountains. q is the number of days. r is the initial height .
In the next q lines, each line contains 3 integers: l, r, val(1<=l<=r<=n, -1000 <= val <= 1000). Means in the day the mountains¡¯ height in range[l,r] have added by val. but you should let the l,r,val xor ans to get true l,r,val. ans is the answer you printed.

 

Output
Print q lines, each line contains a single answer.
 

Sample Input
5 5 0 4 5 87 2 5 -48 3 3 17 4 5 -171 5 5 -494
 

Sample Output
0 0 0 1 1
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-25 23:40:00, Gzip enabled