Pagini: [1]   În jos
  Imprimă  
Ajutor Subiect: Problema subsecvente  (Citit de 1110 ori)
0 Utilizatori şi 1 Vizitator pe acest subiect.
andunhill
Vorbaret
****

Karma: 12
Deconectat Deconectat

Mesaje: 183



Vezi Profilul
« : Decembrie 11, 2010, 19:12:41 »

Enuntul: " Let’s define a value of a sequence as the difference between the largest and the smallest number within that sequence. For example, value of sequence (3, 1, 7, 2) is 6, and value of (42, 42) is 0. Find the sum of values of all subsequences of consecutive elements of a given sequence. "
(2 ≤ N ≤ 300 000)
Imi dati si mie niste idei? Eu ma gandeam sa tin un arbore de intervale in care sa retin maximul si minimul din fiecare interval apoi sa iau fiecare subsecv si sa calculez , dar nu cred ca se incadreaza in timp. (limita 1 s, 64 MB).
Memorat
Pagini: [1]   În sus
  Imprimă  
 
Schimbă forumul:  

Powered by SMF 1.1.19 | SMF © 2006-2013, Simple Machines