| # | 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
Hmm can you explain more? Thanks! IMO one [Edit] I figured out how to do it... Basically you look at 1, 10, 100, 1000... and combine finding sum and checking the binary search condition. |
|
0
A proof in plain language: Consider two When But that's fine because either So |
|
+1
I had a solution for problem E that's a bit simpler conceptually. (Doesn't require the harmonious series observation or changing the timeframe from It's based on the following observation: If a monster is fought when Given above, we can walk from position Now we still need to decide what's the smallest Again based on the observation, this can be found by binary search. When checking whether we will fight that monster for The overall complexity is still |
|
0
You are right. The sizeof only accounts for static memory. That explains it. 48B is what I got with Thanks for your help! |
|
0
Auto comment: topic has been updated by Sigh (previous revision, new revision, compare). |
|
+8
They could have just said that you need to cut the string into substrings with <=k length instead of all that word bs... |
|
0
I got WA with log first, then AC with log2. And after contest I tried again with log and EPS, that also worked. You can take a look at my submissions. |
|
0
I guessed that with a bit of intuition, but not sure how to approach a formal proof of it. |
|
+22
A brief tutorial to problem E, for people like me who cannot follow the official one: Value $$$x$$$ will appear in one of the edges iff: $$$L \leq px \lt (p+1)x \leq R$$$, where $$$p=ceil(\frac{L}{x})$$$. Now we enumerate every value of $$$p$$$ and count the number of possible $$$x$$$ for each $$$p$$$. For $$$p=p_0$$$, the above inequality gives range of x: $$$\frac{L}{p_0} \leq x \leq \frac{R}{p_0+1}$$$. Note that there is a hidden constraint of $$$ceil(\frac{L}{x}) = p_0$$$. This translates to $$$\frac{L}{p_0} \leq x \lt \frac{L}{p_0-1}$$$. Combine the two ranges above, we get, for $$$p=p_0$$$, possible values of $$$x$$$ satisfies: $$$\frac{L}{p_0} \leq x \leq min(\frac{R}{p_0+1}, floor(\frac{L-1}{p_0-1}))$$$. And we use sqrt decomposition to solve this counting problem: For $$$p\leq sqrt(L)+1$$$, we compute the range of $$$x$$$. For $$$p \gt sqrt(L)+1$$$, we have $$$x \leq sqrt(L)$$$, so we can just iterate through all $$$x$$$ values. Complexity is $$$O(sqrt(L))$$$. |
|
+33
LOL. Some people solved C with incorrect solutions that they figured out within minutes and moved on. And those who realized that solution is incorrect will be punished. What kind of fairness is that? |
|
+19
It's a bad idea because some poor people like me spent ~30min trying to solve it and ~20min trying to understand why so many people solved such a hard problem xd |
|
+1
They probably used machine translation. The solution to E is impenetrable. |
|
0
My solution to G2 with dfs and range query data structure(BIT for example): First get the pre-order sequence of the tree, store the time stamp when you enter/exit each node. For each query, find the node X with max depth, and node Y with min depth. As described in the solution, X must be one end of the path. Let's enumerate the other end. We put +1 on the timestamp you enter each node, and range_sum(X,Y) gives us the number of points covered by path X-Y. Now we enumerate each node Z in the set, skip it if it's on path X-Y(can be determined by timestamp), otherwise see if range_sum(X,Y) + range_sum(Y,Z) = |S| + 1. |
|
On
Phantasy →
Another solution for Google Code Jam 2022 Round 1B problem C (ASeDatAb, Test Set 2), 4 years ago
0
Ah, I thought there was another post XD |
|
On
Phantasy →
Another solution for Google Code Jam 2022 Round 1B problem C (ASeDatAb, Test Set 2), 4 years ago
0
I had exactly the same idea but failed to implement it correctly... Since this is 'another' solution, could you point me to the other solution? Thanks! |
|
+1
My sol of problem D: First, observe that the values of array only get permuted but not changed. So sum of c[i]s should be n*(number of 1s). Thus number of 1s can be calculated. Now you immediately know the sorted array of timestep n: 00..0011..11. And for former timesteps, The nth position is left unpermuted. Thus if c[n]>1, a[n]=1, otherwise a[n]=0. After that you remove the influence of timestep n from c[i]s, and repeat for timestep n-1,n-2,...,0. |
|
On
emorgan →
Codeforces Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round), 5 years ago
+3
Imagine when you have 200000 numbers each 10^9, and you have to break everything into 1 before returning NO |
|
0
The verdict of interactive problem is super confusing. I get TL while it should be WA. |
|
0
Aww I realized that the irreducible fraction is actually irrelevant. Since if u calculate $$$\frac{a}{b}=\frac{tu}{tv}$$$, where $$$gcd(u,v)=1$$$, then $$$ab^{-1} = tu(tv)^{-1}=uv^{-1}$$$ mod P. Sad that I didn't get this during contest... |
|
+11
Well I do have something similar: First, observe that the timesteps that cleaning is possible are cyclic, with cycle length no more than $$$4max(m,n)$$$. Then, find the cycle, suppose it's $$$p_1, \cdots, p_c$$$. Calculate the gap between neighboring points to get $$$g_1, \cdots, g_{c-1}, g_c=L-p_c$$$. Then the answer is $$$[g_1 + g_2(1-p) + g_3(1-p)^2 + \cdots + g_c(1-p)^c] [1+(1-p)^c+(1-p)^{2c}+\cdots]$$$ And the latter term equals $$$\frac{1}{1-(1-p)^c}$$$. That's where I stuck, cause I dont know how to simplify the fraction... |
|
0
Anybody have idea on how to get the irreducible fraction in problem D? I was able to derive an analytical form involving (p%)^i, (1-p%)^i, and O(n) constants. But if I calculate the fraction under mod P, it becomes hard to simplify the fraction. And I cannot find a way to simplify it in its analytical form... XD |
|
+10
Yes we definitely can, and that's what I attempted during the contest. I'm just feeling idiotic for not realizing the trivial simplification. |
|
0
Aww I didn't realize (1+2x+x^2)=(1+x)^2 and was thinking to use NTT... How stupid! Thanks for the explanation! |
|
-8
Ideas for problem D? I think it might be Qpow+NTT, but 10^5 seems to be a bit big for that... |
|
+10
It is indeed meaningless to test whether people consider such edge case, but I guess it won't take too long to figure out where's the problem after getting WA? |
|
+8
O(nsqrt(nlogn)) should work for n=100k. Example: 1540D - Inverse Inversions |
|
+7
Any O(nlogn) solution for Div1C/Div2E? I only came up with sqrt decomposition XD |
|
0
NVM. Thought it was D. |
|
0
You are right. The method I mentioned has time complexity O(nk). If binary search is used, it becomes O(k^2logn). Since n=0.5m, k=8k, the complexities are about the same. If monotonicity is used to optimize binsearch, it should be several times faster. I'm being careless when doing the analysis XD. |
|
+3
I didn't check the correctness of your code, but there is indeed more efficient algorithm for this problem. First, binary search is not needed, since as #ride become smaller, mins increase monotonically. This will eliminate a logn factor in time complexity. Second, a simpler approach is possible for checking whether some s is valid given #ride. Consider team size $$${v_i}$$$, Now you first take largest v, and then you want to see if another smaller team can go with them. It can be shown that instead of taking the team with maximum possible size, you can just look at $$$v_1$$$. So basically you take elements only from left and right side of the array. No need to use set. My code: 127899137 |
|
0
Yes you are right. I only looked at your first claim, and didn't notice that the trick of finding the last occurrence will account for this. Thanks for the clarification! |
|
0
I think such simplification can not be done. Consider a sequence whose sum is 2m-1, m>0: We not only want $$$ps_x$$$ = m-1, $$$v_x=1$$$ is also required. |
|
0
Already figured out D2D is calculating combinatorial number but didn't have the time to implement it... sad :( |
|
0
I noticed that top-ranked guys solved the first several problems within 20 mins. I was like, how is that possible... I'd say that I came up with the solutions once I understood what the problem was saying. And I also didn't get any WAs for those problem, which would incur delays. But it still took me about 50 mins :(. Is there any special techniques other than reading/coding speed that makes those guys incredibly fast? |
|
0
Anyone can help explain why ans for Div2 E2 with n=5 is 904 rather than 819? It seems that I somehow misunderstood the description, but idk how... A simple py program that outputs 819 for n=5: Update: nvm, i thought the 'lexicographically smaller' do not include cases when p1=q1, because I didn't see these cases in the example with n=4. |
|
+1
You are right. I guess it might just be typo and ci stands for j<i, pj<pi. At least with this definition of ci the algorithm seems correct :) |
|
+4
Check the definition of bi again dude. bi here means number of elements greater than pi. So to get ci, which is number of elements smaller than pi, you need i-bi. |
| Name |
|---|


