Join our online coding competition and tackle fun problems designed by Google engineers! ➡️g.co/kickstart
Round C starts in less than 24 hours (on May 23rd at 11:00 UTC).
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Join our online coding competition and tackle fun problems designed by Google engineers! ➡️g.co/kickstart
Round C starts in less than 24 hours (on May 23rd at 11:00 UTC).
Название |
---|
Yay AC.
I realised that the OJ server is laggy, is that your experience as well?
I had to wait for at least 2 min to see if my C passed or not (9 times). It was really annoying. I wonder what the reason was for this slowness.
Same, it was really frustating, I reloaded the page actually and that basically just removed the submission, when I did it again, again it was coming again I reloaded. Then at last I finally waited after submitting and I saw now that all 3 submission came simultaneously, and all were wrong, now what is this.
same happened with me i faced 3 extra penalties due to this:(
I don't know if it is just me or not... but almost every time I have to wait several minutes to submit my code :(
Yeah I also feel some lag while submitting solution.
+1
I even submitted the same code twice because of that.
.
Problem B mostly same as https://atcoder.jp/contests/abc190/tasks/abc190_d
just divide the final answer by 2
And you explained me quite well here
That's why I remembered this problem:)
Reunion xD
Benefits of upsolving XD
It is available on leetcode and Binarysearch too: Leetcode Binarysearch.
LoL I just realized I did this in exactly same way as I did this Atcoder D
in Atcoder one I printed ans*2 here ans
Congratulations Errichto on winning the round
Eagerly waiting for your screencast (to know how I messed up today)
Thanks and here you go https://youtu.be/TagGSh6QALs
How to solve A test case 2?
Since analysis doesn't seem to have been posted yet, how to solve final subtask of P3?
I managed to get an expected value of 16000 with the following but no clue how to improve:
For E = W, random gets you 20 expected wins and 20 expected draws, I believe this is optimal and can't be improved.
For all other cases, find the best constants A, B, C, D where A + B + C + D = 60 such that playing Rock A times, then Scissors B times, Paper C times and Rock again D times produces the best possible answer for such a method.
Turns out such constants can get you an expected win rate of $$$28.13 \times E$$$ for $$$W = 0$$$, $$$28.71 \times E$$$ for $$$W = \frac{E}{10}$$$ and $$$31.51 \times E$$$ for $$$W = \frac{E}{2}$$$, so a total expected score of $$$500 \times \frac{28.13 + 28.71 + 31.51 + 40}{4}$$$ or $$$16000$$$.
The analysis is already published.
I after many adhoc thoughts, wrote a dp and it came simple enough dp involving states n, number of rock, scissors and paper. I used double also in hope to manage precision . At last constructed the solution, using the character to be chosen for maximum.
I did not find the round interesting also C was really weird. Managed to solve the first 2 and get a rank of 1400'ish. Here are the ideas,
Simple counting problem, iterate uptil n/2 on a string as we dont care about the other half and then fix current position and then add $$$(s[i] - 'a')$$$$$$k^r$$$ to the answer and decrement $$$r$$$. Initially $$$r$$$ is the number of free postions after we fix the first position. Also check all edge cases.
This was also a math problem. After a bit of rearrangement we get this : $$$(D + 2K)(D + 1)$$$ $$$=$$$ $$$2G$$$ where $$$D$$$ is the number of days. Now factorize $$$2G$$$ into product of 2 numbers and bruteforce over these pairs to get the value of $$$D$$$ (set them either $$$(D+1)$$$ or $$$(D + 2K)$$$ and check if the $$$K$$$ value is valid and increment the count.
B can also be solved by noticing the number of days cannot exceed $$$\sqrt{2 \times G}$$$ as then even starting from $$$1$$$, we get $$$\frac{n * (n + 1)}{2} \gt G$$$.
Also notice that there is exactly 1 way to get a given score in a given number of days, as $$$sum_{i = j}^{i = j + k} {i}$$$ increases as $$$i$$$ increases. Since this property is monotonic, we can binary search on it, solving the problem in a total of $$$O(\sqrt{G} logG)$$$
B is equivalent to just counting the number of odd divisors of $$$G$$$
Expected value of probability of asking a problem from "Probability Theory" in Google Kickstart or Codejam =1.
Can someone help me to provide a counter-case for A, please?
...
Thanks a lot, buddy, just a tweak and it passed both tests. Thanks, again! Although, I wasted my 2 hours in searching for the mistake :'(
I used a condition s[i]<s[n-i-1] till i=(n+1)/2 to check if the ans would be increased by one.Turns out I was wrong. I implemented it in another way and got AC but anyone can help me with 1st approach.
Could somebody share how they came up with a good enough hash function for D? I came up with functions $$$(a \cdot RAND + b) \% mod1$$$ and $$$(a + RAND1) \cdot (b + RAND2) \% mod2$$$ pretty fast, but they didn't pass the second case and I was having trouble creating a better function.
$$$(70 * (a + 45) + 40 * (b + 9)) * (130 * (a + 23) + 90 * (b + 7))$$$
Just some random sum and multiplication. it worked for me.
Thanks, indeed I tried (after contest) hash function $$$(a \cdot a \cdot RAND1 + b \cdot b \cdot RAND2 + a \cdot b \cdot RAND3 + RAND4) \% mod$$$ and it seems to work. I'm not sure why my functions were too weak though.
First can be easily failed with addition and second with multiplication.
For example, $$$(a\cdot RAND + b) \% mod1 + (c \cdot RAND + d) \% mod1 = (a\cdot RAND + d) \% mod1 + (c \cdot RAND + b) \% mod1$$$ (if b and d don't overflow $$$mod1$$$, but assume they are small enough)
For second one similarly $$$f(a, b) \cdot f(c, d) = f(a, d) \cdot f(c, b)$$$
Thanks for the explanation!
Is Q4 meant to be solved using hash function ? I was thinking doing all non sense using bigint and all with max 200 digits
Asking this because this is the first time I came across a real use of hasing in CP.I always felt hashing is luck dependent so why would anyone use it in a contest
You can use a custom hash function for the # operations, but it needs to be strong enough (this solution is mentioned in the official editorial). About it being luck based: the probability of it actually failing is usually very low, and you can further decrease it by using a tuple of hashes instead of only one. And you don't need big int because you can just calculate everything modulo some prime.
for problem B . After analysing on first 100 values of 'g' . I found out that answer is total number of odd unique factors of 'g' . And finding factors can be done in O(sqrt(N)) for given value of N. I need proof for this :).
Let’s suppose if we start at a units, and we get g units in d+1days. Hence, a+(a+1)+(a+2)+...+(a+d)=g. Hence, (d+1)*(2a+d)==2g. Now, the rest of the proof is pretty straightforward !
got it . Thanks !!
Me after reading C:
"I will never play rock paper scissors ever again!"
I can't understand what problem C meant they gave so confusing explanation too
If anyone has good explanation please link it here
I solved A subtask 1
B complete question
and D subtask 1 but I used randomisation and python large numbers
The transitions in the editorial for C are wrong.
Should be: \begin{split} v[r][p][s] & = & \max & (v[r — 1][p][s] + \frac{p}{n — 1} \times \mathbf{W} + \frac{s}{n — 1} \times \mathbf{E}, \ & & & v[r][p — 1][s] + \frac{s}{n — 1} \times \mathbf{W} + \frac{r}{n — 1} \times \mathbf{E}, \ & & & v[r][p][s — 1] + \frac{r}{n — 1} \times \mathbf{W} + \frac{p}{n — 1} \times \mathbf{E}) \ \end{split}
I made the same mistake. It cost me 1 penalty, 30 minutes and 50 strands of hair
Could you explain it?
If we choose rock, we win if the opponent chooses scissors and draw if they also choose rock. The probability of them choosing scissors is $$$p / (n - 1)$$$ and the probability of them choosing rock is $$$s / (n - 1)$$$ (according to the problem statement). The cases in which we choose paper or scissors can be handled similarly.
Oh right, it's my bad mistake. I thought the opponent chooses S with Pr[S] = s/(n-1).
Thanks!
Good to know that I was not the only one. Sadly I did not figure it out during the contest.
Can precision loss be an issue? I did the same but it failed and I still don't know what's going wrong in my solution https://ideone.com/iedIGo
Between oversleeping and some mix of panic/annoyance at the lagging judge, I ended up chipping away at smol solves and settling in on D which (EVENTUALLY) worked out... thought I was being smurt by putting in an intentional TLE (infinite loop) to diagnose an RE bug, but somehow managed to both fix the latter (break rather than keep trying to parse an input that got shortened) by adding something unnecessary (account for (0)->0) while also adding an actual infinite loop bug (attempting to get a unique randint from too narrow of a range)... tl;dr crappy rainboy impression was actually crappy...?
272nd is the best I've done in these sorts of things, not sure how to feel about it... maybe slightly relieved after failrun at codejam round 2...?
Your performance is the perfect depiction I have seen of the constant reminder everyone gives but hard to follow of "reading all the problems". Good job lol
Problem D is really easy to implement in Python. We don't even need to parse the expression manually, but rather we can let Python's built-in
eval()
take care of it.The idea is to override the
|
operator (or any other unused operator) and then replace all existing occurrences of#
with our overridden operator. Theeval()
function can then automatically parse and evaluate the resulting expression. We only need to provide the hash function.I didn't know the inbuilt implementation of eval I did something like this
I upsolved it with a random oracle function
In the "Rock Paper Scissor" problem, for the DP transactions there is no proof provided that the optimal answer for a particular state is resolvable from one of the exact previous state. I don't see why that would be the case always.
If you have an optimal (highest-scoring) strategy, take any prefix, suppose it has
r
rocks,p
, papers, ands
scissors. Then that prefix is the highest scoring among all strategies withr
rocks,p
, papers, ands
scissors, as otherwise, you could rearrange the prefix and get a strictly score overall.The problems were quite good, but the system works worse and worse everyday. I faced numerous issues with loading problem statements just after beginning at Kick Start Round B and Code Jam Round 2. It took almost minute for me to load at least one problem statement. Today at Kick Start Round C I spent even more time trying to load problem statement. At some point a saw the "Something went wrong, please try again in 30 seconds" message. And I was not deceived, I had to wait for more than 30 seconds before the next attempt to load a problem statement. And yes, all these delays between submitting and displaying the queued attempt left me with tons of doubts:
Is the issue on my side?
How much time a have to wait before doing something?
Should I submit the solution again?
Should I refresh the page?
And so on... Please, consider updating the contest system. As of today, it is causing too much inconvenience to the participants.
What will be the rating of problems A, B,C, D in terms of CF question ratings
In my opinion, it should be like:
Problem B — Div2 A — 1100 — Tags: Math
Problem A — Div2 B — 1500 — Tags: Implementation
Problem C — Div2 D — 2100 — Tags: DP, Games
Problem D — Div2 E — 2300 — Tags: Hashing
Completely disagree. I think both problems A and B are close to Div2 C. Problems C and D are far from what you typically see at Codeforces contests. Problem C can be solved with DP-approach that is typical for Div2 E / Div1 C. Problem D is about implementation and picking up a proper hashing function. This problem is not suitable for use in Codeforces contests.
I thought D will be interesting and suitable in a Hackforces Educational Round.
Hacking isn't an issue if your function is randomized by time, right?
That wasn't about hacking to be honest. By Codeforces contests I rather meant contests with hidden verdict. It might be very unpleasant to got WA only because for $$$#$$$-operation you picked one of the few functions that fail system testing.
Then I disagree. Choosing a proper hashing function is part of the solution. This could be used in a CF round and the main drawback is only that it's somewhat standard.
(btw. getting WA on systests is always unpleasant)
Google kickstart
Smaller Strings
Getting TLE for Test Case2
(Following official editorial's method)
`Can someone suggest any improvements please?``` ~~~~~ Your code here...
} ~~~~~
You need to compute the answer modulo $$$10^9+7$$$. It seems like you forgot about it.