Code Jam R2 starts in ~24h (Saturday, May 19th 14:00 UTC)

Let's discuss the problems after the contest!

Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

# | User | Rating |
---|---|---|

1 | Radewoosh | 3443 |

2 | tourist | 3372 |

3 | OO0OOO00O0OOO0O0…O | 3264 |

4 | ksun48 | 3176 |

5 | scott_wu | 3168 |

6 | CongLingDanPaiSh…5 | 3157 |

7 | Benq | 3154 |

8 | Petr | 3139 |

9 | Um_nik | 3138 |

10 | LHiC | 3118 |

# | User | Contrib. |
---|---|---|

1 | Radewoosh | 195 |

2 | Errichto | 176 |

3 | rng_58 | 158 |

4 | Ashishgup | 157 |

5 | neal | 156 |

6 | tourist | 154 |

7 | Petr | 151 |

8 | PikMike | 150 |

9 | Um_nik | 149 |

10 | kostka | 147 |

10 | Swistakk | 147 |

10 | Vovuh | 147 |

Code Jam R2 starts in ~24h (Saturday, May 19th 14:00 UTC)

Let's discuss the problems after the contest!

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/11/2018 17:48:09 (d3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

ok

I wonder what the exact scoring rules are.

They were not important in Round 1, but are important for me and people of my level now, in Round 2.

Case 1:

Attempt 1. Solve Small correctly and Large incorrectly.

Attempt 2. Solve Small correctly and Large correctly.

I think I get +1 penalty here, no doubt.

Case 2:

Attempt 1. Solve Small correctly and Large incorrectly.

Attempt 2. Solve Small correctly and Large incorrectly.

But do I get +1 penalty here? (I hope not, it would be nonsense, but let's wait for approved answer)

There is a section explaining the scoring system in the FAQ. ( https://code.google.com/codejam/resources/faq )

They take in consideration your earliest attempt that passed the visible tests, and your latest attempt, and give you points/penalty based on the better of the two.

So for your examples, you would get +1 penalty in Case 1, and get no penalty in Case 2.

BUMP! Round starts in less than 30 minutes. Good luck and have fun! :)

Why this shows round 3? https://codejam.withgoogle.com/2018/

Yeah, same problem here. What the heck?!

It did somehow fix by itself :D Reload a page :D

It didn't for me. I can't submit! Damn, can someone fix this?!?!?!

I'm writing my address and all those stuffs just to start the contest. I already wrote this about 5 times when taking 2018QR, and now I have to write this in the middle of the contest? If you don't want to give me t-shirts, then do it in the fair way.

Can someone please fix the contest? It keeps showing 20 hours for Round 3. If I go to Past Contests, I can see problems from Round 2, but I can't fu**ing submit !!!!!!

Anyone from Google around? This is unacceptable!

idk, try a different browser or change time on your computer (it does affect some websites)

Google doesn't care about CF (or particularly about competitive programming in general), you should write to the Codejam Google Group. Although I don't know how much requests there are watched...

One guy had broken round 1C, the dashboard ignored timezones and had the round "start" 2 hours earlier — the problems weren't visible for those 2 hours, so he had 30 minutes to compete. This bug only happened at one computer, but it was pretty persistent (restarting browser or cache clean didn't work).

It's more efficient to email codejam@google.com if you found an issue, especially if it's time-sensitive.

they don't want to fix it, I emailed them about the issue last round as my contest ended after 1:30 instead of 2:30.

Had a lot of ideas for D, cant think of how to keep my code clean and effective .... Should've gone for small instead of going for large + AK. :/

Edit:

Me and my teammates after the contest:

Me: Whew, this is the first time I ever used the simplex template, it actually fit into B's TL!

Teammate: Isn't it DP?

Me: What?

Teammate: What?

Edit 2: So it turns out I am the only edgy kid who used simplex for B ... ?

How did you use simplex for B?

Maximize dot(c, x):

c is a column vector filled with 1, each entry of x represents if we will pick (x reds, y blues), so dot(c, x) will be the amount of jugglers we have at the end.

Simliar to the editorial make sure you only keep pairs that are possible to be juggled with the amount of chainsaws we have.

While satisfying Ax <= b:

First two rows of A will be representing the constraints on how much red / blue chainsaws we have, if the i-th entry of x represents (x reds, y blues), then A[0][i] = x, A[1][i] = y. Set b[0] = Red, b[1] = Blue, such that we will never exceed the budget.

For the i-th entry in x, to make sure we don't have jugglers which share the same juggling arrangement, add extra rows where A[i+2][i] = b[i+2] = 1.

Code:

https://ideone.com/VA2Uvw

Simplex template credit goes to MIT 2008 ACM template.

Can you please elaborate a little on last part to ensure that we don't have jugglers sharing same arrangement?

It makes sure max(x) <= 1, similar to how you prove IP is NPC from knapsack.

Makes sense now. Thank you :)

How can you be sure that the answers from simplex solver are integers?

I am not sure about the proof -- But I suppose that the problem nature encourages the simplex solver to take pairs which spends less chainsaw to attain maximimzed real results, and taking floor shouldn't hurt.

239 people with 100 points... that's a lot more than last year's 7.

Was C Augmenting Path/Max-Flow?

just bipartite matching(n^2 — match matching for each value)

OMG, it seems I copied not-working code from the internet).

For C, why the greedy idea (Let

sthe sum of size of maximum matching for each number, thenanswer=n^{2}-s) fail?I regret wasting too much time on C, not realizing that D is actually easier than C.

That's the correct answer for C.

Then what the ... (trying my best not to speak bad language) is wrong with my solution for C

You forget to reset

`visited`

between different DFS calls.Except it should not fail... I suppose you built a flow graph w.r.t row/column for each number?

Meanwhile me failing to code D.

IMO C was the easiest problem today :P

Finally, someone who shares my opinion.

Could you explain your solution?

Iterate

xfrom -nton. For eachx, we will find the maximum number of cell with numberxthat we can keep unchanged. To do that, build a bipartite graph, each vertex on the left right represent a row, each vertex on the right side represent a column. Add an edge fromuon the left tovon the right ifa[u][v] =x. Then, the number of cell we can keep is the cardinality of maximum matching in the above graph.I just don't why finding a maximum matching in above graph correspond to maximal independent set in original graph.

What's the meaning of taking edge ij?

Each edge is corresponding to a cell in the original graph. In the maximum matching, no two edge coincident to the same vertex, similar to how no two chosen cells should be in the same row or column.

Consider the following example

If we consider number 3, then the bipartite graph will look like the following:

One possible maximum matching is (1, 2), (2, 2) and (3, 3), which corresponding to the solution of keeping cell (1, 2), (2, 2) and (3, 3) unchanged.

Thank you so much.

Is there any scrapper available online to filter contest results by countries at least?

It's currently not available for this contest but some guy from CF updates this site regulary.

https://codejam.herokuapp.com/

Here is one: http://gcj.aditsu.net/scores?r=2018-2

There is also this one created by Diego1149 :)

https://goo.gl/1uwya8

More explanation here: http://codeforces.com/blog/entry/58941

How to solve C? I thought that we should compute minimum vertex cover in the graph where we have edges between vertex with the same color and (same row or column) but this graph is not bipartite. :(

B large Fail Test Case?

Wow, compilation error still counts as penalty attempt.

Yeah, I also got one in previous rounds for using C++17.

I believe my OK large test submission was obscured by CE submissions after it. Is it really ok?)

Can someone give me a hint why this code is failing in A : https://ideone.com/hVQGi2

At this point I like to generate random input to see if it crashes.

Ty very much:)

How to solve D?

I think this should work:

Notice that if you go deep enough, any fixed-size pattern can only be part of a very simple grid composed of 4 quadrants with the same colours (let's allow a quadrant to have colour None to deal with edge cases). Each such grid is formed by expanding a square 2x2 in the original grid sufficiently many times; there are at most 81 of them, so we can find all such colourings by brute force.

Now, we can try dividing the original grid into 4 parts by a vertical and horizontal line; there are

O(RC) ways to do this, we can try them all. We can also try all possible colourings. For each of these cases, we know which cells can't be in our pattern, and out of the remaining cells, we can build the largest connected component. Then we just need the maximum of all CC. TimeO(R^{2}C^{2}).Using 2

^{4}= 16 coloring isn't too difficult either. You just have to expand 1x1 and 1x2 colorings to matching 2x2 coloring when checking which ones are present.In the end, my implementation could just ignore colourings with None, so not even expanding anything was necessary, but using dummy objects that simplify implementation and only increase the constant factor is a good approach in many problems.

My python implementation TL'd on large, so sad. 100 tests x 16 colourings x R^2C^2 = 256 x 10^6. Didn't have time to generate maxtests, but was pretty sure that should fit...

Has it happened to you that a solution thats calculates all the 500

^{2}answers and then solves each test in constant time passed the small, but not the large? What is wrong with their platform? How is that supposed to work?Code:

SpoilerVerdict is: AC on small, TLE on large.

Locally runs on just over 9s.

Their TL is 25s.

There are probably many reasons why your code can get large wrong while passing small. What you have described here is definitely too less to draw any conclusions.

Fair enough. I've added some information to my comment.

OK, if that is TLE then it is definitely weird :P. Hypothetical WA could have been easily your fault.

Btw, I know that is irrelevant, but you can change

to

and your code should remain correct.

I know, I figured it out later during the contest, but I did not resubmit, due to obvious reasons XD.

Yesterday, I'm pretty sure I solved a problem by resubmitting (1B B, I was trying an alternative solution that was getting TLE sometimes). And in 2B here, I got TLE on something that was running in 4 seconds locally, even though the time limit on the server is much larger.

Maybe they're measuring time with an hourglass or something?

Well, that's definitely an unpleasant experience to have during actual contest. Maybe they should pay more attention to testing their platform more thoroughly before throwing it to the world.

Update: Resubmitting after the contest ended, the verdict was AC on small and large. Guess you have to submit at the right moment to do well on this contest.

How stupid.

Try making some noise about it to organizers. They should be aware of platform's weaknesses. It's not only your business, we too don't want such surprises in future :D.

I have written an e-mail to them. I hope they will catch up with the issue, and it won't happen in the future. Thanks for the idea.

Damn, O(n^4) got AC? Nice.

For me, 501x501 array solution first gave MLE :) on the small test set, then exact the same code passed smaller, then gave MLE on big test set, then third time, gave WA on big test set. But WA was correct.

Any "hacks" for falling balls? Had wrong answer but haven't figured it out yet.

If you are seeking tests for the small:

Try this one...

I can't understand official solution for c. What's the intuition behind taking at most one vertex from edge AiBj?

Getting wrong answer for B, but then I took someone else's code that was accepted, generated cases for all possible R & B and took a diff of the output with my code. Surprisingly it's the same. Edit: Figured it out, there was an overflow while calculating the dp

SpoilerNow, The tests are assumed that can be all maximum? In the past, there are small testcases and a few large testcases.

In some problems in rounds 1, the constraints were in the format "3 out of 100 tests are maxtests, the rest are small", so you should probably assume all tests are equally large unless written otherwise. It makes sense if you need to pass test

ito pass testi+ 1.## Scraped scoreboard for all rounds so far in GCJ 2018.

https://docs.google.com/spreadsheets/d/10q6bxqgnd0U9KNzGFvAl7Ik6kWZ8_wbfiUMRN-cJdXE/edit?usp=sharing

For fucks sake, I didn't solve task because forget to put '#' in 'Case #x:'

I got WA and didn't understand why.

So, suicide is the only way.

Another way: Copy the expected output and diff it with your output. (I also learned that the hard way.)

Calm down dude

same with you with 6 wrong submissions for problem A

For "Graceful Chainsaw Jugglers" problem, I was thinking of a greedy solution. It is as follows:

Make all possible pairs such {A,B} s.t. A+B = i. Here we iterate i from 1 to 1000, and if (R-A

_{k}) ≥ 0 and (B-B_{k}) ≥ 0, then we update ans = (ans + 1), R = (R - A_{k}) and B = (B - B_{k}).I got a WA, but I am not able to come up with a counter example. Any help is highly appreciated.

It doesn't work for some cases where R and B have a large difference. Depending on the order of iteration over the pairs with A+B=2, the case 39 3 might fail for example, choosing

But you could optimally choose (1,1), (2,1), (8,0) instead of (0,2), (11,0).

I see. Thank you so much! :)

Just curious, did it come intuitively to you, or you generated some test cases and tested against an AC code?

During the contest I at first thought greedy might be correct, but after some time had the intuition that there would probably be a counterexample with larger numbers and larger difference. For actually finding a counterexample now I had to generate some test cases.

`11 11`

->`9`

:Thank you for the help, but it seems the above algorithm managed correct answer on it.

Submitted precomputed answers for B (400kb of code):

I did the same and got AC, close to 1 mb of code

Same. 750kb.

Can you please post your code here. 750Kb seems a lot better.

https://gist.github.com/juanplopes/2da67aebda9b4b08b9efc751b421d566

I forget that file size is 1M instead of 64K(in many other oj) so I compressed my table and encode it with base64

LOL

I think there is even no restriction on file size. I reread FAQ a couple of times and didn't find anything about it. I believe they control it only by compilation time exceeded.

It is mentioned in the Terms but not FAQ.

See "Code Jam Rules 4.2(A)"

Is there a yahoo code jam or baidu code jam?

Yup, but only legendary grandmasters can participate. Yahoo here, baidu happens in late dec

thank you for the info

This entire new UI is so weird. Has so many problems with it. Always kind of asks for logging in, even when I am logged in. Its so weird. The older platform was much better.

I spent 90 minutes trying to debug my code for the last problem, and it turns out I had misread the problem statement...

When it says

"present in at least a googol deeper dream grids",I interpreted"present inAfter a lot of wrong submissions, I re-read the problem statement and still failed to catch my mistake. In the end, I didn't have any time left to think the harder part of problems B and C and, because of that, I ended up ranking 1200+.of googol deeper dream grids".at least oneI was sleepy and kinda upset because my computer clock was wrong at the start of the contest, not allowing me to submit for the first 30 minutes.

But,I still think that the words "at least" shouldn't have been there. It leads to confusion. It would have been much clearer if it said "present in 10^{100}deeper dream grids or more".More on the matter of the clock: It's

utterly unacceptablethat a competition like Google Code Jam has code that readsyourcomputer time to tell you when the contest starts/ends instead of reading it from a Google server. I lost 30 minutes because of that laziness/stupidity from the designers of the page. I hope they fix that for the next contest, because I wasn't the only person affected by that. Just read the comments on this page alone, and there's at least one other guy.