Codeforces и Polygon могут быть недоступны в период с 23 мая, 7:00 (МСК) по 23 мая, 11:00 (МСК) в связи с проведением технических работ. ×

Knight Tournament TLE

Правка en1, от Mr.Awesome, 2016-10-30 13:20:47

I was trying to solve this problem but i got TLE.

In short terms the problem is :

You are given m queries each contains three integers l,r,x, (l<=x<=r) and you have to fill segment [l,r] with integer x except for the element of indices x, ex. if l=1,r=3 and x=2 segment [l,r] = {2,0,2}.

My solution use an indicator array called nxt to avoid filling the already visited segments and go to the next unvisited item, so this should be done in O(n), however i'm getting a TLE and i can't figure out why.

this is my submission

any help or hint is very appreciated.

Теги tle, sets, 356, round 356

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Mr.Awesome 2016-10-30 13:20:47 699 Initial revision (published)