Some error occured while loading page for you. Please try again.

We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

n is number of sequences so ther might possible more then 2 sequences. In that case you need more array like b[],c[].Max possible size of these arrays are q so there you can also save some memory.

## Dynamic Array

You are viewing a single comment's thread. Return to all comments →

n is number of sequences so ther might possible more then 2 sequences. In that case you need more array like b[],c[].Max possible size of these arrays are q so there you can also save some memory.

Thanks a lot friend!I got my mistake.

I have the same problem can you explain??

n = number of sequence lastAns=0 q = number of query sequences S0={} S1={} S2={} . . . Sn={}

for queries type (1) 1 x y index of sequence id = (x^lastAns)%n append y in Si-th sequence

(2) 2 x y index of sequence id = (x^lastAns)%n lastAns = valueAt(y%(size of Si-th sequence)) and pint lastAns

after every query value of lastAns will be updated according to query type.

what is y and x

y and x are integer inputs (given in question)

what is the size of every sequence??

according to me it must be n, but i'm guessing that size of each sequence should be exactly the amount of elements that are present at that moment.

Yes, the sequences start of as size 0 and grow as you add elements in.

so what should we take the size initially

Yeah. That sentence has terrible phrasing.

Sequence is a dynamic list. in Java Arraylist or in C# List is ok to use i think?

Can also use 2D Vector in Cpp

yes i did it with vectors

watch each input line after the first one.

1 0 5

this means, query type 1, x is 0 and y is 5

Thank you so much, understood this now

Thanks! It was unclear.