| # | User | Rating |
|---|---|---|
| 1 | jiangly | 3810 |
| 2 | Benq | 3676 |
| 3 | Kevin114514 | 3655 |
| 4 | maroonrk | 3463 |
| 5 | strapple | 3447 |
| 6 | Um_nik | 3387 |
| 7 | heuristica | 3322 |
| 8 | turmax | 3317 |
| 9 | tourist | 3307 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 156 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | Um_nik | 141 |
| 5 | Errichto | 139 |
| 6 | adamant | 137 |
| 7 | AmShZ | 135 |
| 8 | BledDest | 132 |
| 9 | maroonrk | 131 |
| 10 | qwexd | 129 |
|
0
|
|
On
CleanAirAndCleanWater →
Which approach for "longest valid sequence in range" query ?, 11 years ago
+16
Everyone whose a SPOJ account can practice the problem described in this link: VMLSEQ I solved this problem. Here comes some main ideas: We can split the given sequence into some arrays of indices (I will call them as chain): For example can be splitted like this: Property: In each chain, for every two element x and y, a[x + 1..y] is a valid subsequence. It's not hard to build these chains, I think you can do it yourself. Now for each query My first approach is sort all queries (l-increase then r-increase). Iterate all queries then update result via a segment tree. Complexity is O(NlogN) for building chain, O(QlogQ) for sorting queries and O(Q * SQRT(Q) * logN) for solving queries. Unfortunately, this solution got TLE in some large tests. The second approach is SQRT decomposition: sort queries and solve them in each SQRT(N) block, separately. This approach have complexity is O(Q * SQRT(Q)) for solving queries. It got 100 points and took about 2s in runtime. You may read the main idea of this approach HERE. The third approach is heavy-light. Consider chains which have size smaller than BUBEN is light, otherwise heavy. For light chains, sort queries and iterate them, save local best of each queries. It takes O(Q + |sum.size.of.all.light.chains|) in worst case. For heavy chains, iterator all queries, with each pair of queries and heavy chain, use binary search and segment tree to find local best. It takes O(Q * |number.of.heavy.chains| * logN) in worst case. Combine local best of two phase, we have the answer for all queries. Chose BUBEN as SQRT(N), the complexity O(Q * SQRT(N) * logN) in worst case but indeed this solution is extremely fast (currently best time). I think it's hard to make a test to kill this solution. My explaination seems confusing since I have no experience in explanning my ideas but I hope this is helpful. The main idea of my algorithm is solve the chains queries offline, I found a problem which can be solved using this method: http://www.spoj.com/problems/ZQUERY/ . Time limit for this problem is relaxing, so you can take some implementations for benchmark. All of algorithms I described have complexity SQRT(N) as a factor, I'm curious about the poly-log algorithm. Please share here if you have such that kind of algorithm. UPD: There is an algorithm with complexity O(N4 / 3). Let's separate given sequence into S blocks, we can create dp[i][j] = Length of longest valid subsequence from which starts at block i and ends at block j. Sort all queries then solve each of them with O(N / S) in worst case. So we have a solution with complexity O(S * S + Q * N / S). Set S equal to N2 / 3, we have an O(N4 / 3) solution (considering N = Q). However this approach took 1.8s in the problem, much slower than the third. |
|
0
How do you cut the cake in case N = 11. I always think that there isn't any solution with number of cut needed < 6. |
|
0
Sorry, I think you were misunderstood the problem. We can not move the cake while we are cutting so the equation: an = an / 2 + 1 is wrong. Example: N = 11 your program returned 5 but we need at least 6 cuts: 3 horizontal cuts divide the cake into 4 pieces: 4/11 4/11 2/11 and 1/11 then vertical cuts divide the cake into 16 pieces: 8 pieces 1/11, 4 pieces 1/22 and 4 pieces 1/44. There isn't any solution with less than 6 cuts. |
|
+1
In ORGANIZATOR we can use sieve eratosthenes and array f[2e6] mean that f[x] is the smallest prive factor of x so we can find all factor of x in O(log x). Next we generate all division of x, it is about log(x)*log(x) number. In contest I only find prive division of x so i fail all test. At the end of contest I see my wrong but too late. Here is my AC solution: http://ideone.com/kmrO5I |
|
On
Nakochi →
Calculate first 50 digits and last 100 digits of N! (Factorial Problem, data is really large, N <= 10 ^ 8)Anyone can help?, 13 years ago
+2
About the first B digits, the problem has something same to this problems in hackerrank. The solution is to calculate the first k digits of x, we calculate log10(round(x/10^k)). => Editoral of it. The function can be calculate easily if we can calculate log(n!) in O(1) or O(log(n)). About calculate log(n!) you can see here. |
|
+6
My first submission is 14 min after contest but it still in queue. In current standing I see Egor accepted C 30 min after contest. The system test work down, i think i should sleep and ignore this contest |
|
0
When I run applet it always unable to launch. I go to topocder but the page can't be access. I can only launch applet at half of contest and in challenge phase I was kicked out of applet. Anyone tell me it topcoder's error or my network's error? |
|
+24
as his wiki today is his birthday. congratulation and happy birthday tourist |
|
+1
Can it be display in English? I don't know Russian, I copy problems from foxit reader to google translate but is not suitable to translate |
| Name |
|---|


