Hi, Everyone!
At Jan/20/2019 15:05 (Moscow time) will start Codeforces Round 533 (Div. 2). Round will be rated for second division (rating below 2100). As usual, participants from the first division can participate in the contest out of competition.
The round will consist of 5 problems in which you will be helping some of my friends and you will be given two hours to help them.
I would like to thank MikeMirzayanov for the Codeforces and Polygon platforms, cdkrot for round coordination and help with preparation. Also thanks to vintage_Vlad_Makeev, Aleks5d,budalnik, Arpa, mohammedehab2002 and ---------- for help with preparation and testing round.
As usual score distribution will be announced shortly before the contest.
Good luck!
UPD1: I'll be on the Discord channel after the contest, so we will be able to discuss the problems.
UPD2: Score distribution : 500-1000-1500-2000-2500
UPD3: The Editorial is ready.
which you will be helping 5 of my friends
What does this mean?
And also... thank you for the contest!
Also... why is the time so early?
Oh okay, thanks! Then on Sunday I guess it's
cuz I'll be taking USACO contest too. :)
I knew it!!! The date of the contest would shift as there can't be 11 days gap b/w 2 Codeforces contests.
I see your comments in contest discussions, but the last contest you participated was back in Aug 2018.
Are you one of those guys who are worried about rating drops and watch contests like a football game? :thinking:
Why are you so angry, bro? I will give the contest once I get hold of the topic I have been practicing!!!
best time for the contest... i will not miss my dinner
its much better than 18:05 thank.
I believe that it would be a nice round Warawreh ;)
i beliebe that it won't ;)
Lets see !
During this time my neighbours are very loud :(
Oh at 2 pm I will still be in church, maybe next time then, goodluck with your contest though hope it will be a success and codeforces like its problems.
I am expecting a really great round ! Warawreh ♥
I love the original rounds like this one more than any other modified rounds! :D
jordanian problem setters ، so excited to this contest
bad timing
I don't understand, why do you think a fine Sunday evening (for Indians) is a bad timing? :thinking:
Because maximum times contest is organized at night and that is the best time to give contest because you are relaxed from all the works. So comparatively it's bad time. That's it.
I think,it is your first round in CF Warawreh.Hope no ambiguity in problem description.Good luck.
i found leaked footage containing codeforces admins working hard
Level 100 Boss
Damn, I know that Americans are a minority on codeforces, but many of the recent contests have been at bad times (6 AM) for us in California, and this one is 4 AM as well. :'( Of course it doesn't make sense to base the timing off of americans, but I hope there will be one at a reasonable time for us soon!
What? The 6 AM round is the best kind of round, because you can just wake up and play right away. No more anxious waiting. One and done.
Haha yeah, that's true. When I can wake up that early, 6 AM is good. But I like sleeping in too much to wake up that early these days.
In our country, many (recent) competitions start at 23:35(UTC+9). Most of the contests end at 01:35 or 02:05. I cannot sleep until then and sometimes I sleep later (at around 3 to 4 A.M.) in competitions where they have open hacking. Isn't it better for the competition to start at 6 a.m.?
Your 6 is someone's 2.
I think your reply should be posted in a different comment.
Yeah, of course any time is good for some people and bad for some other people. I've just noticed that all the competitions recently are at this same time. I think I would just like to see some competitions at different times.
Thanks god it's sunday otherwise i will be in college till 5:30pm (IST)
I think it will be a great round.
.
Jordanians problem setter, but it clashes with Jordan vs Vietnam match.
Sorry Jordan, we don't have a jordanian codeforces round set up by my friend every day XD.
Please just order problems correctly by their difficulty, because lately many round setters didn't :D
One of these rounds you are talking about D/E had the same score so do try to check the score instead of letters before saying that https://codeforces.net/contest/1100/standings
That contest may have failed to control the difficulty level because the problem setter set problem for the first time. (But it was a bit harsh. The difference in the rating between problem C and problem D was 1100.)
That's not one of the contests I have in mind. I will give you 2 examples I was referring to:
Educational Codeforces Round 58 Where Problem E was far easier than both problems C and D. Yes I know this is an educational round and it's based on ICPC rules, but still that's not a good thing given that it's traditional for problem E to be harder than both C and D.
Hello 2019 problem F is easier than problem E.
Fair enough. For Hello 2019 it's a bit less clear since a huge part of the problem was that the O(N * sqrt(N) * log(N)) intended solution works fast enough. That educational E was really a joke tho...
The first time I see Codeforces Round at 7h00 pm in Vietnam. However, Vietnam National Football team is going to have a match at 6h00 pm. "Viet Nam Vo Dich"
Clashing with Atcoder contest
Some guys said ustat is dead,
Tell them, the ustat is back.
I think the author made a mistake in the title. It should be "Codeforces Round #533 (Div. 3)".
Почему Д такой мусор?
Все дизлайкать эту мусорку!!!!
Ребята я на раунде мне не смешно поддержите лайками!!!!
Можно было дать сэмпл, в котором у какого — либо игрока > 1 замка? Потратил 47 минут на дебаг, не успел подумать над E. Спасибо, авторы, было очень вкусно.
Я воспользовался опцией задать вопрос, получил ответ и через пару минут общее оповещение по этому вопросу. А раунд хороший: тут всё для див2 решаемо и пишется довольно легко.
How to solve C ?
dp[n][3]
dp[i][j] is the number of ways to make an i digit number, having remainder j
Can you explain it little detailed ?
suppose you have an i digit number that sum of its digit modulo 3 is j then if you write digit x in the end of that,then you have an i + 1 digit number that has sum (x + j) % 3 so you can say : dp[i + 1][(j + x) % 3] += dp[i][j]
you can calculate this dp in O(n) because x have only 3 general states,and at the end, the answer is dp[n][0]
sorry for my poor english
This comment was helpful for problem E :)
E:Helping Hiasat
No, I don't want to help him, he is so hypocritical.
4th test for E?
It fails when you no of connected components.
Maybe -
12 4
1
2 a
1
2 b
1
2 c
1
2 a
2 c
1
2 b
2 c
Я правильно понял, что E это втупую поиск максимальной клики?
15th test on D?
I think it had something to do with needing to do a multi source BFS instead of a single source BFS.
Can someone tell me why I am getting TLE on pretest 6 on C? Submission
Slow input caused by cin
Nope, I submitted 6 times, with cin optimizations, without them, with scanf, etc. All TLE. Besides, it's only 3 numbers.
True, had problem D in my mind with that large input. Didn't remember C only had 3 numbers, my bad.
But cin is ok for problem D.
If you don't use the sync_with_stdio line I don't think it is
I think so,but why not use it
The solution he had linked had that line commented, hence it would have TLEd for a large input problem. That's where I mixed things up and thought problem C had a large input and that was the reason for the TL.
2 1 1 try this one
Excuse me while I go kill myself.
i've got TL 6 with same bug. while(r % 3 != mod) r--; in c++ negative number % x is negative.
Nice problemset!
Is E something like building a graph of friends that can't both be picked (i.e. there's an edge between two friends if they both cant be satisfied) and then doing meet in the middle on that to try and find the best valid subset of friends?
Use meet in the middle to speedup the naive algorithm for finding maximum independent set.
Do anyone passing the pretest for problem E using randomized algorithm for Maximum Independent Set (MIS)?
**Update: System test Accepted ;)
You must have some balls of steels to submit it in a rated contest. If this isn't rated for me I would have tried to use this opportunity to test my simplex template.
Well, I'm just trying whatever I know because I don't know any other algorithm to solve MIS problem :(
Bruteforce was too slow, but I was lucky to find the correct solution before. Just a timer to exit the search early if necessary. 48631423
Yes, my randomized brute passed, but it was not at all the intended soution.
48635541 I actually got stuck during the contest, why did my submission of problem C get time limit exceeded ?
Try 1 1 1
Thank you so much, I wonder how stupid I was
Was D just an implementation problem or there was some observation to do for speed-up? I implemented (naive) multi-source BFS but still getting TLE
BFS is good enough.
I tried to calculate the distances of every free cell to each player (using the speed information) and calculate for each cell, the first player to reach them. But i got WA because there are some cases where a player can block other and reach a cell first even having to play more rounds. So i thought the right solution was the naive BFS and didn't have time to implement it. Now i'm curious too =)
BFS with early break out should be good enough, because each cell will be pushed to the queue no more than once, and will be visited extra no more than 4 times (you can "bump" into each square once from each direction).
yep, that's exactly what I thought. How do you deal with 'speed of expansion'? I implemented a lower-level BFS that will expand until distance_from_local_source < player_speed, probably that got me a TLE
Try this testcase
3 3 3
...
###
123
BFS stops at first iteration for every player because the queue doesn't get any new element pushed? Was that your point?
Yes I got a tle because of this.
The contest reminds me of how much do I hate hacking in div2 contests -- A problem is either trivial and submitted by a lot of people, making it boring to go through all of them, or there are very few people who submitted it...
Yes, I am salty about losing 5 hacks to another roommate who only started hacking 30 minutes before I started. ;_;
Shouldn't this solution give Runtime error? on 1 1 a https://codeforces.net/contest/1105/submission/48622609
a[i+1] for i = 0 will give garbage value, it'll work without RE
It gave WA eventually :(
Probably the worst round in Codeforces history, imbalanced and not interesting problems, didn't expect it from such a noname.
ShutUp..!! It was good.
I bet you think so just because you didn't try to solve anything except ABC
...
How is your phrase related to my comment?
..
I don't understand what you want to say. I didn't state anywhere that I'm good at something. It was said, that this round is bad, and your performance depends only on your hands
Only because you did well
I don't think so.
D is prue implementation, and E is a classic algorithm just using Meet-In-The-Middle. Jf course, if your level is at ABC, you won't feel that anything's wrong with DE and so on, but that doesn't make these tasks good and worthy for Codeforces
That's true to some extent, but there were even worse competitions.
Okay, I agree, maybe it's not the worth, but one of them obviously
Is E just finding size of maximal independent set with meet-in-the-middle? If so why do you do things like this?(((
Warawreh's hit contest
Someone please help me, For problem A
I tried a hack on the solution.
This solution initializes s[n+1] but uses s[t] somewhere between the code.
For a test case like:
s[] should overflow because, t can take values from 88 to 100, but s[] is initialized only for 0 to 1.
But my hack failed. Why is his solution still printing the right answer?
UPD: He failed main tests :/ . Still it was my first ever hack and learnt about how overflow actually works :)
I suppose that only s[3] and s[4] is corrupted due to overflow, you need a testcase to trick the code into reading these two slots.
Oh so is that how overflow works?
I thought any number greater than the limit would have created overflow...
Can u explain me in detail?
This is what my Operation System course taught me:
So, when the C++ code writes "s[n+1]", the OS allocates some memory to the code, and the same thing happened when it asked for memory for p and j. The OS make use of the stack and use the 2 records right after s[n+1], which, pointer arithemetic tells you that it is equivalent to s[3] and s[4] (Or around s[3], I am not entirely sure about this tbh. Perhaps since s[3] is allocated to the array to store '\0' so it is actually s[4] and s[5]).
Then, when s[88] is called, it look into *(s+88), which is not occupied by anyone. Luckily, this is also not out of the memory bounds that the OS allocated to the process, so calling s[88] will neither access corrupted memory nor trigger segmentation fault.
Thank you for the explanation. It was my first hack (though it failed), I learnt something new :)
Any clue to get past pretest 5 on D?
People like thinking during a contest, do not take away this opportunity from them
At least you can quit in the middle of a contest ;_;
Gentlemen don't do that
Problem C is so cool for me. Thanks for this contest, its very nice! :D
I have to say that problem D is really really really inappropriate to be D. May be C and D could have been swapped.
BTW pretests are too weak, my friend failed both B and D. Hope that will never happen again next time.
Hmm... this is weird...
but anyone have any ideas of pretest 15 of D?
try this case
4 3 2
2 1
1..
1..
..2
...
Figured. Thanks.
Also, this maybe a bit too much, but I'd be glad if the part one or more castles in statement of problem D is written in bold or italic to emphasize it.
I wasted 3 failed submissions and half an hour by misreading this part, thinking each player will only start with one castle. It's not that I want to blame, but such crucial information should be emphasized.
Why are there so many Failed System Test in problem A?
Some people only checked for t = values of the given array for some reason.
... Okay, but I think other reasons also exist.
many sort the array pick the middle and calculate the ans.
Thank you.
Many players assign x to the median of array a
I suggest that the key words should be BOLD in the statement.
I got accepted on problem B with DP solution
Seems too overkill
Div. 2.5
Congrats Warawreh.
Impresive Debut as a problem setter in CF.
What is the combinatorial solution for C? Anyone explain please.
How come c++17 is much faster than c++14?
Here 2 codes for D First Submission Second One
A whole half second seems rather cruel despite using scanf
This is just too cruel.
Yeah totally shitty,candidate master gone cause of a simple weird mistake
Pretest 5 of D:
4 4 2
1 1000000000
....
....
..2.
...1
Can someone explain why the final state of the board is:
2222
2222
2221
2211
rather than
2222
2221
2221
2111
And why would it be the second one? first player will only expand 1 cell up and 1 cell left in the first move (as his expansion speed is 1), and then the second player will fill out the board with his huge expansion speed.
Oh, I misunderstood this problem. I didn't realize that player i could take any square that was si distance away, I thought the problem meant that it could taken any squares si distance in the direction left, up, down, or right (i.e. could only expand in straight lines).
I suppose I was confused because the problem said "castle", and I immediately imagined rooks from chess. Definitely much more my fault than the problem setter's, but still very annoying because I spent an hour of the contest looking for a bug in my code.
Alternating moves was not clear from neither the statement nor the sample tests, but they made an announcement regarding this.
Oh that's right, I do remember them making a statement about D. I was working on E and forgot about it. Stupid mistake.
The first player only has 1 speed expansion, that means the state of board after the first player play is:
....
....
..21
..11
Then, the second player plays filling the rest of the board.
2222
2222
2221
2211
Why t can't be 0 in problem A ?
From problem statement:
"The value of t is not fixed in advance and you can choose it as any integer."
Thanks man. I wish I had seen it :(
I too got WA first time. So read the question again and found this.
It was a good contest with clear explanation of the problem.
Can someone help me find bug in this code for Div2D : 48619139
Could anyone solve C using combinatorics (without DP)?
What a nice planning. I have to wait just 2 days for comeback :D
why this code for problem D get WA on test 38? https://codeforces.net/contest/1105/submission/48642621
For problem C:
I kept on trying it with stars and bars method, DP didn't occur to me.
I used divide and conquer with memoization.
I think worst case complexity of D will be O(n*m) (In each chance if we acquire a cell) Player x will not play again in subsequent rounds if he wasn't able to play in previous round.
Is it just me, or this div2 round was a lot more accessible than most of other div2 rounds (even considering only the div2 only rounds)? I am curious about other people's opinions!
i agree with you strike ,it seems problem c was easier as more than 2000 contestants were able to solve it and problem b was also easier than a lot of div 2 rounds
Deleted
time limit for D was too strict, no python solution passed the TLE during the contest.
you can check out my python2 implementation of intended solutions gets TLE at test case 13
also all these other solutions from other users in python3 got TLE even if most of them are correct as in the editorial TLE test case 13
TLE test case 13
TLE test case 13
EDIT: I implemented a solution using collections.deque but still gets TLE, is anyone able to get AC on problem D using Python? up to now no one did.
Such a strangle thing. After contest I submit libra8z's submission.48632510.And I got TLE.But the code accepted with 1600ms.How can this happen? Oh,C++17 is much faster than C++11.
What is testcase 45 of problem D?
Can test inputs and outputs be found somewhere on Codeforces after a contest ends? As you know, for large input or output, all of it may not be displayed on submission pages. Actually it's not related only to this contest.
Couldn't understand why I got TLE in problem D. I have attached both my contest time code (in which I got TLE in main test) and AC code written after contest.
The only difference is I added this line " if(v[cur].empty()) return ret; " at the beginning inside bfs() function. But if I don't do this it should return the same "ret" since both v[cur] and q should be empty and no while loop should run. But adding this line is giving me AC in 0.5 sec while skipping this giving TLE with 2 sec+. What's the reason behind this significant difference in time?
TLE Code: 48636948 AC Code: 48646138
It may got optimized. C++ is very hard to understand completely.
in case 45, bfs is called around nmp times, now each time you call bfs you create a new queue, I don't know the details, but creating a queue in c++ is not very fast which is why you get tle, changing that queue to global should greatly decrease the running time.
The default container for a queue is deque, and for some reason it is more heavy than other data structures. The size of an empty queue (with deque container) is 80 bytes, while if we change the container to list, it will be 24 bytes.
The same solution gets accepted after changing the container to list:
queue <PLL,list<PLL>> q
— 48669305.So I think it is mainly memory allocation / deallocation that makes it too slow. The solution is declaring around 80 * 9 * 106 = ~686 MB while using list container would declare 0.3 of that.
I use C++11 and then I got failed on system test.(i.e.TLE in test 45).And when I changed to use C++17.I got Accepted with 1600ms.How can C++11 and C++17 have so big differences. Maybe C++17 std::queue is optimized
please help me to find out what's wrong in my code problem https://codeforces.net/contest/1105/problem/D
solution https://codeforces.net/contest/1105/submission/79372365