ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1126. Magnetic Storms

Anton hint [1] // Problem 1126. Magnetic Storms 12 Nov 2011 07:33
Segment tree can help solve the problem. I've got AC 0.046s 512Kb.
My steps:
1. Read all input and build segment tree
2. Get rmq(i, i + m - 1) for all needed i
IgorKoval(from Pskov) Re: hint // Problem 1126. Magnetic Storms 14 Jan 2012 02:10
I cann't believe. It DON'T get TLE.

    for( long i = m-1; i < (long)arr.size(); ++i )
        cout << *max_element( arr.begin()+i+1-m, arr.begin()+i+1 ) << endl;

=)