[gcj] Re: ESAb ATAd problem [Codejam 2020 qualification round]

2020-04-07 Thread Wing-chung Leung
1. If you don't flush, the output can just stay in the output buffer of you program, not to reach the judge. 2. Unless you find that your code will exceed 150 queries, most likely you have a hidden bug in your program, especially those "array out of bounds". I guess you're also qualified. Aren'

[gcj] Re: Analysis of Indicium (Codejam 2020 Qualification Round)

2020-04-07 Thread Wing-chung Leung
The analysis said "We can greedily pick any perfect matching for each row *starting with the rows with B and C on their diagonal*.". But you're starting with A. On Tuesday, April 7, 2020 at 9:05:20 AM UTC+8, Maverick wrote: > > I am unclear on the analysis of *Testset-2* of Indicium >

[gcj] Some tips to prepare

2019-09-25 Thread Wing-chung Leung
Without information on you I can only give some general tips: 1. Do a few past problems. 2. Study data structure and algorithms. 3. Practice with online judges. 4. Study some math. But your approach should vary greatly on your current situation, your target in Code Jam, and the time per week you

[gcj] Need help to find out why my program got a TLE in New Elements Part 1

2019-05-20 Thread Wing-chung Leung
Dear all, I want to know why I receive a TLE for the small data set with the program below. All your help are appreciated! (I failed to reproduce the RE/TLE myself. So I need an exact data set that fails to work.) Or is there any difference between the judge environment and by PC? P.S.

[gcj] Details about Wrong Answer

2019-05-06 Thread Wing-chung Leung
Basically you won't get any information from the result unless the solution crashes (RE), time/memory limit gets exceeded, or fails to compile. It is up to you to figure out the exact case you fail to handle, because the test cases are not going to be exposed. It can be a trivial case (e.g. n=1)

[gcj] A question regarding the probability involved in the gopher problem

2019-04-16 Thread Wing-chung Leung
Just a side note: did anyone here recognize that you need only 6 attempts/modulos to reach 100? -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-co

[gcj] Unofficial participation

2019-04-16 Thread Wing-chung Leung
Maybe I should elaborate more on this. I think that it might be a good idea to allow contestants to unofficially participate in Round 3, and get a private unofficial rank. (e.g. this guy has performed as well as the guy who got rank #678 in round 3) This will give recruiters a better picture o

[gcj] A question regarding the probability involved in the gopher problem

2019-04-15 Thread Wing-chung Leung
You can combine the techniques of inclusion-exclusion principle and "stars and bars" to obtain a formula (which is very long, because the formula has 5 big terms due to inclusion-exclusion principle.). I don't have the time to find out the exact formula though. -- You received this message bec

[gcj] Asking for help for Round 1A Pylons

2019-04-13 Thread Wing-chung Leung
Dear all, I'm unable to get the output pass Test Set 2, even if it passed my own validation. I would appreciate if anyone can point out what's my mistake, especially those in my validator code. Thanks! Regards, WC Leung. // Compile with MinGW-64 in MSYS2 #include #include #include

[gcj] Analysis for Foregone Solution

2019-04-08 Thread Wing-chung Leung
Actually my solution would be wrong if a number did not have any digit 4. LOL! -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googleg

[gcj] Re: Improved local interactive runner

2019-04-08 Thread Wing-chung Leung
When you compile a C# program, you'll get a .exe file either in bin\Debug or bin\Release. So you should get a command prompt in the source code folder, add my runner and also your own testing_tool.py in same directory. Then run the program then type the following into the command prompt: python

[gcj] Improved local interactive runner

2019-04-07 Thread Wing-chung Leung
Dear all, I guess you have tried using the interactive running tool, and somehow get frustrated that it is very difficult to use. In particular, it's syntax is complicated, and it has no timeouts. (You can manually shut down the frozen process though.) So after the ordeal I've decided to i

Re: [gcj] Bathroom Stalls - Time limit exceeded

2018-08-23 Thread Wing-chung Leung
The question statement says 30 secs. https://codejam.withgoogle.com/2018/challenges/0130/dashboard/0652 -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it,

[gcj] Kickstart Round D question A and B

2018-08-14 Thread Wing-chung Leung
Did you have integer overflow that you didn't notice? -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To post to thi

[gcj] Info

2018-08-02 Thread Wing-chung Leung
The easiest time to check is usually in March or on the 1st of April, because the qualification round usually starts in mid-April. BTW, why not join the next round of code jam kickstart on Aug 26? The questions there are also easier! (This is true for me for the rounds I mentally solved. Discla

[gcj] Re: 2018 1A Edge Baking Analysis |S(K)| ≤ 2K + 1

2018-05-18 Thread Wing-chung Leung
I have assumed l_1 >= l_2 >= …, so the case q < 1 doesn't exist. Anyway, the assumption is made because the final result is not affected by the order of processing of the intervals. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubsc

[gcj] Re: Round 1B 2018 Rounding Error : proof that we must maximize the number of rounded up languages

2018-05-14 Thread Wing-chung Leung
The proof of the statement in the analysis is likely very complex. I tried for some time, but didn't get the proof done (or refuted). Anyway, the statement "We get the maximum answer when as many of these as possible are rounded up." is different from your post title ("we must maximize the numb

[gcj] Re: Has anyone solved Question 3 from round 1C in python?

2018-05-08 Thread Wing-chung Leung
On Tuesday, May 8, 2018 at 10:25:26 AM UTC, henrik...@googlemail.com wrote: > I would really like to see how the Python Solutions that pass comfortably > look like. If I understood things correctly, the solutions in this thread > which pass just pass barely (with 13 secs out of 15 secs), and the

Re: [gcj] Sort problems on Google Code Jam based on difficulty/easiness.

2018-05-08 Thread Wing-chung Leung
On Monday, April 30, 2018 at 4:30:11 PM UTC, Anil M wrote: > Thanks everyone for the input, I think I should get all contestants and who > solved what, hopefully majority of them used same username over the years. > Once I have all the data if I have anymore questions I will get back. Tagging >

[gcj] Re: Has anyone solved Question 3 from round 1C in python?

2018-05-08 Thread Wing-chung Leung
> h= len(D)-1 > while(D[h]>6*w):#this stops as D[0]=0 > h-=1 The part quoted above makes the algorithm O(n^2) instead of O(nk). (n = number of ants, k = max height of stack). We may think that O(nk) and O(n^2) are similar (so do I). But we are wrong. Instead, for W <

[gcj] Re: 2018 1A Edge Baking Analysis |S(K)| ≤ 2K + 1

2018-04-25 Thread Wing-chung Leung
Well... I didn't read that part |S(K)| <= 2K + 1... good question. It's not that hard anyway... Consider the intervals [a, pa], [qa, ra], where a, p, q and r are real numbers. From the questions (ignore the integers), you have p >= sqrt(2), and r/q >= sqrt(2). Considering the cases q >= sqrt(2

[gcj] Re: 2018 1A Edge Baking Analysis |S(K)| ≤ 2K + 1

2018-04-25 Thread Wing-chung Leung
Turns out that wrong proof was not too far from the correct one, which is written down below: Suppose we process [a, pa] on the intervals [0,0], [qa, ra]. We have p, r/q >= sqrt(2). The resulting intervals are [0,0], [a, pa], [qa, ra], [(q+1)a, (r+p)a] If 1 <= q <= sqrt(2) then [a, pa] and [qa,

[gcj] Re: 2018 1A Edge Baking Analysis |S(K)| ≤ 2K + 1

2018-04-25 Thread Wing-chung Leung
Oh... made a mistake in my last post so just ignore me. :-( I'm really poor... (or if possible, not to approve my post) -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send

[gcj] Why this code is wrong (practise session Q.1) - not accepted

2018-04-11 Thread Wing-chung Leung
Read the question again. You did something very different from what the question asked for. You are to do the guesses instead of outputting those TOO_BIG things. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group

[gcj] Re: How to get the top K records from a huge dataset?

2017-04-30 Thread Wing-chung Leung
If you have 1G memory, you should be able to store 64-256M IPs without using hashtables, considering that you use a 16, 32, or 64 bit number to store the visit count. If you have a new PC, you can possibly store the whole IPv4 address space in memory, so multiple scans isn't necessary. Anyway,

Re: [gcj] wrong output submitted

2017-04-18 Thread Wing-chung Leung
The penalty of doing this wrong is much smaller than a wrong large dataset... only a 4-minute penalty plus a re-run. That's why nobody is complaining (unless the contestant submit the solution in the last minute). On Tuesday, April 18, 2017 at 3:49:34 AM UTC+8, Pablo Heiber wrote: > > That bein

Re: [gcj] Round 1A has finished!

2017-04-17 Thread Wing-chung Leung
Indeed your final solution in A is mathematically correct: (1) There is a first row that contains one or more letter. For these letters, the "up" will always stop at the first row, and "left" / "right" operations performs in the same way as if the empty top rows are not present. (2) "Left" and

[gcj] Re: About the time requirement of question D in round 1A

2017-04-17 Thread Wing-chung Leung
On Sunday, April 16, 2017 at 3:04:03 PM UTC, Wing-chung Leung wrote: > So I'll put my questions here: > (1) is there a better algorithm to do this? Turns out the answer is "yes". The reason: in the simulations, if the dragon have full hp, it get hit the same number of ti

[gcj] Re: Round 1A 2017 Problem C: Play the Dragon

2017-04-17 Thread Wing-chung Leung
On Monday, April 17, 2017 at 1:18:39 PM UTC, DSL wrote: > Hi, > > I tried the problem for practice and got correct answers to all but two of > the small input test cases. Could someone please help provide sequences of > commands that result in the correct answers for each of the test cases belo

Re: [gcj] wrong output submitted

2017-04-17 Thread Wing-chung Leung
On Monday, April 17, 2017 at 12:37:42 AM UTC, Xiongqi ZHANG wrote: > First of all, the input file always begin with the number of test cases. > > Secondly, the submission page will always stop you from submitting answer if > the number of test cases in input/output file mismatches. > > So it wil

[gcj] Re: About the time requirement of question D in round 1A

2017-04-17 Thread Wing-chung Leung
True. Today I've compiled again with no apparent changes, but the timers are normal. Release: 16 secs. Debug: 90 secs. Appears that something went wrong on my computer that day. Very strange because cache locality issues appears unable to explain the problem. And even a reboot didn't help at t

Re: [gcj] codejam kick start problem

2017-04-17 Thread Wing-chung Leung
ind a > hidden dp formula and finish the code in 5 mins. > > 在 2017年3月10日星期五 UTC-8上午6:55:58,Wing-chung Leung写道: > > I'm okay to solve some math problems in a coding challenge. You may suspect > > that I lack math skills, but in fact the exact opposite is true - I get &g

Re: [gcj] wrong output submitted

2017-04-16 Thread Wing-chung Leung
On Thursday, April 13, 2017 at 11:21:23 PM UTC, Xiongqi ZHANG wrote: > One easy option is to use different test case number for small/large input. > > So at least you will be warned that the test case number does not match. > Possible... but that would add some burden to the user unless the test

[gcj] About the time requirement of question D in round 1A

2017-04-16 Thread Wing-chung Leung
First, congrats for those who manage to solve the question. I didn't manage that with literally every single formula derived wrongly. BTW, after fixing those formulas and applying the ideas from the analysis, I have the file at the bottom of the message. What confuse me is the time to run the s

Re: [gcj] wrong output submitted

2017-04-13 Thread Wing-chung Leung
Is it possible for google to reject submissions if the answers are the same as a previously accepted and correct small submission? For incorrect submissions or not-yet-marked large submissions I think it is impossible to reject because the answer is not directly linked to a correct answer for a

Re: [gcj] Re: Analysis is up for Qualification Round. Take a look!

2017-04-10 Thread Wing-chung Leung
The solution in Google+ needs to take the logarithm, and that is O(n) in many implementation including the Google+ solution. I'm highly inspired by the rest of the argument though. Anyway, my addition: if you allow "0" as a an element of the tree, then you always have a complete binary tree, e.

[gcj] Result of Qualification Round.

2017-04-10 Thread Wing-chung Leung
You'll receive an email if you advance. BTW, there's no concept of cheating in the qualification round, so if you get the score you automatically advance. Things are different in later rounds though. -- You received this message because you are subscribed to the Google Groups "Google Code Jam"

[gcj] Problem C - Bathroom Stalls

2017-04-10 Thread Wing-chung Leung
Even though it says "data structure", all you need is ONE variable to record the larger value. The smaller value is always one less than the larger value. And then two more variables to record the count is sufficient. BTW, and discussed in another thread, if you're also given the value of the m

[gcj] What is basic edu. need ?

2017-04-09 Thread Wing-chung Leung
Just some math, and the ability to code. If Code Jam was available when I was attending primary school, I would be participating. Even at that age I had a decent chance to get into Round 2. Of course joining that way is against the rules about age, so your best bet is to impersonate as someone

Re: [gcj] codejam kick start problem

2017-03-10 Thread Wing-chung Leung
I'm okay to solve some math problems in a coding challenge. You may suspect that I lack math skills, but in fact the exact opposite is true - I get massive advantages if a problem contains math. Last year I've got a code-jam T-shirt (didn't get to round 3 though) almost solely by applying math

Re: [gcj] codejam kick start problem

2017-03-09 Thread Wing-chung Leung
Thanks, but depressed to know that we need to solve algebra instead of code in a code jam. I'm not complaining about the use of math here. But in this question a CAS will make the calculations, i.e. the essence of this question, trivial. -- You received this message because you are subscribed