Need help for data structure problem

Правка en2, от CarlaZZ, 2015-07-08 21:26:10

We have got N number, from 1 to N. There are 2 types of query:

  1. move number from index i to index j
  2. write what number is at index i

ex.

(0,1,2,3,4);

2 ? -> 2

(0,1,3,4,2); <- from 2 to 4

(0,4,1,3,2); <- from 3 to 1

3 ? -> 3

4 ? -> 2

(0,4,1,3,2); <- from 1 to 1

0 ? -> 0

1 ? -> 4

2 < N < 10 000 000 M < 500 000

I tried with the sqrt-decomposition but not fast enough.. any ideas? http://cms.di.unipi.it/#/task/vasi2/statement

Теги data-structures, sqrt_decomposition, range tree, avl

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский CarlaZZ 2015-07-08 21:26:10 47 Tiny change: 'y ideas?\n' -> 'y ideas?\nhttp://cms.di.unipi.it/#/task/vasi2/statement\n'
en1 Английский CarlaZZ 2015-06-25 23:53:00 472 Initial revision (published)