hi , anyone have any idea about how to solve D. Serega and Fun using treap ?
thanks for any help
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
6 | adamant | 157 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | djm03178 | 153 |
hi , anyone have any idea about how to solve D. Serega and Fun using treap ?
thanks for any help
I found this interesting problem here
the problem :
We have an array of integer a[1], a[2], ... , a[N] and a number M.
We take a version of selection sort like this:
for i := 1 to M do
for j := i + 1 to N do
if (a[i] > a[j]) then swap(a[i], a[j])
After the program end, count the number of swap operator in it.
Limitation:
1 <= M <= N <= 10^5
abs(ai) <= 10^9
any idea for the solution please ?
thanks in advance ^_^
here is the problem
it's really an interesting problem but just a few people have solved it
I came up with o(n^2 * log2(n)) solution (using dp and segment tree)
it could pass only 40% of test cases
someone told me it could be solved using convex hull trick
so please explain your solution
thanks in advance
there are N workers in Mirko's factory. They are manufacturing cars on a conveyor belt, in a pipeline fashion.
Workers are denoted by numbers 1 – leftmost, to N — rightmost. Each of the workers does his specific job and requires certain amount of time to complete it.
Production of a single car starts with worker #1 (Mirko). After he had finished with his part of the job, worker #2 takes over, after him #3... When worker #N finishes with his part, the car is finished.
Mirko and his workers have to produce M cars and they must produce them in order 1 to M.
For every worker i we know T[i] — time required for him to do his part of the job.
For every car j we know factor of assembly complexity F[j].
Time in minutes for worker i to finish his part of he job on the car j is computed as a product T[i]*F[j].
After some worker has finished working on a car, he has to give it to the next worker instantly, without any delay (weird company policy).
For that reason, the worker receiving the car has to be free (he must not be working on some other car). In order to fulfill this condition, Mirko has to choose a good timing to start building a new car. To be efficient, he’ll wait minimum number of minutes until he is certain that all of the conditions described are met.
Write a program which will, given worker times and factors of complexity for each car, compute total time required for producing all of the cars.
N,M <= 100,000 T[i],F[i]<= 10,000
I have already finished wcipeg's tutorial for convex hull trick.
I tried to solve APIO'10 Commando but I'm getting WA after test 9 and the same for Usaco ACQUIRE
I tried to submit the official solutions which is posted in wcipeg tutorial but still getting WA after test 9
anyone has solved them, or there are some mistakes in their test cases ?
another question , in that tutorial all the example problems were offline version or when each new line inserted has a lower slope than any line currently in the envelope
so please give me some problem required convex hull which has no guarantee of either condition holding (each new line to be added may have any slope whatsoever)
thanks in advance
UPD : I've got AC in both Commando and ACQUIRE
I don't see any ads on Codeforces , so how does Codeforces make money ?
Name |
---|