I have submitted all usaco guide solutions and it gives "wrong answer on test case 2" for all of them Problem link
In case that link doesn't open Try this
The Problem:
The Mountain Amusement Park has opened a brand-new simulated roller coaster. The simulated track consists of n rails attached end-to-end with the beginning of the first rail fixed at elevation 0. Byteman, the operator, can reconfigure the track at will by adjusting the elevation change over a number of consecutive rails. The elevation change over other rails is not affected. Each time rails are adjusted, the following track is raised or lowered as necessary to connect the track while maintaining the start at elevation 0.
Each ride is initiated by launching the car with sufficient energy to reach height h . That is, the car will continue to travel as long as the elevation of the track does not exceed h , and as long as the end of the track is not reached.
Given the record for all the day's rides and track configuration changes, compute for each ride the number of rails traversed by the car before it stops.
Internally, the simulator represents the track as a sequence of n elevation changes di . Initially the rails are horizontal; that is, di=0 for all i .
Rides and reconfigurations are interleaved throughout the day. Each reconfiguration is specified by three numbers: a , b and D . The segment to be adjusted consists of rails a through b (inclusive). The elevation change over each rail in the segment is set to D .
Each ride is specified by one number h — the maximum height that the car can reach.
Input The first line contains an integer n (1≤n≤109 ), the number of rails. The following lines contain three kinds of queries:
I a b D : configuration change. The rails from a -th to b -th inclusive after the execution of the request have an elevation equal to D . Q h : start the ride. It is required to find the number of rails that the trolley will pass, which is able to rise to the height h . E : end of input. This request will appear exactly once at the end of the file. At any given time, the height of any point on the track is in the range from 0 to 109 . The input contains no more than 100,000 lines.
Output For each query Q print a single integer: the number of rails that the trolley will pass.
Auto comment: topic has been updated by code4dj (previous revision, new revision, compare).
Auto comment: topic has been updated by code4dj (previous revision, new revision, compare).
Auto comment: topic has been updated by code4dj (previous revision, new revision, compare).