Mai intai trebuie sa te autentifici.
Diferente pentru problema/verkhoyansk intre reviziile #6 si #4
Nu exista diferente intre titluri.
Diferente intre continut:
== include(page="template/taskheader" task_id="verkhoyansk") ==
Marcel a planuitoexcursieinMuntiiVerkhoyansk,un lant muntos de 1200dekilometri in Republica Sakha.Peisajulpoatefivazutcaunvectorde$N$ numerenaturale,cuvaloriintre $1$si$N$, reprezentandinaltimilevarfurilormuntoase alelantului.
Marcel has planned a trip in the Verkhoyansk Range, a 1200 km mountain range in the Sakha Republic. The landscape can be seen as an array of $N$ integers with values between $1$ and $N$, representing the heights of the mountain peaks along the range.
Marcel are$Q$prieteni.Prietenul$i$vavizitatoate varfurilecuindiciiintre$L[i]$si$R[i]$inclusiv. Marcelvreasastie,pentrufiecaredintre ei,careesteceamaimica inaltimea unuivarf,numar naturalpozitiv,pecarefiecareprieten*nu*o va vizita.Eltrebuiesastieasta pentrua-siplanifica inmod optimurmatoarealui excursie.
Marcel has $Q$ friends. Friend $i$ will visit all peaks with indices from $L[i]$ to $R[i]$. Marcel wants to know, for each of them, what is the smallest positive integer height of a peak each friend will not visit. He needs to know this in order to optimally plan his next trip.
Deexemplu,dacaunprieten viziteazavarfurilecuinaltimile$3$ $2$ $5$ $1$ $1$ $6$ $3$ $5$,ceamai mica inaltimenaturalapozitivaa unuivarf pecareelnuavizitat-oeste$4$.
For example, if one friend visits peaks with heights $3$ $2$ $5$ $1$ $1$ $6$ $3$ $5$, the smallest positive integer height of a peak he didn't visit is $4$.
h2. Input
Peprimalinieafisieruluide intrare $verkhoyansk.in$se voraflanumerele$N$si$Q$.Pea doualinieseafla$N$ numerenaturalecuvaloriintre $1$si$N$, reprezentandinaltimilevarfurilormuntoase.Urmatoarele$Q$ liniicontinfiecare cate2 numere, $L[i]$si$R[i]$,cu$0 ≤ L[i] ≤ R[i] ≤ N - 1$.
The first line of the input file $verkhoyansk.in$ contains numbers $N$ and $Q$. The second line contains $N$ integers with values between $1$ and $N$, representing the heights of mountain peaks. The following $Q$ lines contain 2 numbers, $L[i]$ and $R[i]$, with $0 ≤ L[i] ≤ R[i] ≤ N - 1$.
h2. Output
Infisieruldeiesire$verkhoyansk.out$sevorafla$Q$ linii. Pelinia$i$ se afla ceamaimicainaltime, numarnaturalpozitiv,pecareprietenulcunumarul$i$*nu*o va vizita.
In the output file $verkhoyansk.out$ there will be $Q$ lines. Line $i$ contains the smallest positive integer height of a peak friend number $i$ will not visit.
h2.Restrictiisi precizari
h2. Constraints
* $1 ≤ N ≤ 300.000, 1 ≤ Q ≤ 600.000$
* Pentru $8$ puncte, $N ≤ 1.000, Q ≤ 10.000$ * Pentru alte $8$ puncte, $N ≤ 100.000, Q ≤ 200.000$ si toate inaltimile sunt mai mici sau egale cu $50$ * Pentru alte $56$ puncte, $N ≤ 100.000, Q ≤ 200.000$ * Distributia scorului e diferita de cea din timpul concursului oficial. * Vectorul inaltimilor incepe cu pozitia 0. * Putem observa ca Marcel are foarte multi prieteni. * 0 nu este nici pozitiv si nici negativ.
* For $8$ points, $N ≤ 1.000, Q ≤ 10.000$ * For other $8$ points, $N ≤ 100.000, Q ≤ 200.000$ and all the heights are at most $50$ * For other $56$ points, $N ≤ 100.000, Q ≤ 200.000$ * Note that the scoring is not the same as the one in the official onsite contest * Note that the array of heights is "0-indexed"
h2. Exemplu
h3. Tutorial
Puteti vedea solutia problemei la 'editorial':verkhoyansk/solutie_romana
You can see a solution description in problem's 'editorial':verkhoyansk/solutie h3. Request Contacteaza-l pe autor daca te oferi sa traduci enuntul in limba romana.
== include(page="template/taskfooter" task_id="verkhoyansk") ==