What do you do on Friday evening? Are you busy? Will you take part in our round?
Hello, Codeforces!
We are glad to invite you to take part in Codeforces Round 573 (Div. 1) and Codeforces Round 573 (Div. 2), which will be held on Jul/12/2019 17:35 (Moscow time).
The round will be rated for all participants from both divisions.Participants in each division will be offered 6 problems and 2 hours (to be determined) to solve them. Both divisions will share 4 problems.
The problems were written and prepared by 2014CAIS01, tender, teitoku, winterzz1, chenjb, Subconscious, Claris, quailty, skywalkert and me.
Thank to:
tender for providing stories for some problems.
skywalkert, Claris, quailty, WhaleVomit, NIWIS, WolfBlue and isaf27 for testing this round and giving good advice.
skywalkert for helping me to prepare and translate the statement and tutorial (and sorry for my poor English (╥﹏╥) ).
scanhex for helping us to translate the statement to Russian.
300iq, KAN and MikeMirzayanov for excellent coordination of this round!
MikeMirzayanov and his Codeforces team for amazing systems Codeforces and Polygon! (I like Codeforces forever! )
If you are not busy, please take part in our round on Friday evening! We wish you good luck and high rating!
The score distribution will soon be published.
UPD1: Some of authors will be at the Discord CP Community to discuss the problems after the coding phase. However, please follow the rules and don't discuss the problems before or during the contest by any means.
UPD2: List of contributors is a bit changed, and the scoring distribution will be:
Div.2: 500 — 1000 — 1500 — 2000 — 2500 — 2500
Div.1: 500 — 1000 — 1500 — 1500 — 2250 — 2750
UPD3: Sorry for forcing you to spell our nicknames, 'tokitsukaze' and 'quailty', and some ambiguity in the statements. Anyway, we sincerely appreciate your participation.
UPD4: Editorial
UPD5: Congratulations to the winners!
Div.1:
Div.2:
I am sofa
sjf!!!!!
sjf!!I will take part in this excellent round!!I am so excited.(ps,Green Pineapple is so cute.)
ac automaton fail tree dfs-sequence build persistent segment tree suffix automaton next-pointer DAG figure out SG function
???
This is a famous sentence said by 2014CAIS01. XD
We use it to Orz him!!!
"ac automaton fail tree dfs-sequence build persistent segment tree" is 547E - Майк и друзья
It is something from aliexpress
很蔡盛liang...
CSL nb!!!
Durant & lrving. will. ak. this. game. .
Does the first paragraph mean the contest will be anime themed?
No.
Curiously, I wonder if there are any colorful pictures in this round?
I can promise no anime pictures in this round!
Why do Chinese prepared such late contest?
The contest will start at the time when I arrive home after getting off work :(
Wish you a job promotion :)
Good person located :)
996 Working, _________ :(
I think we're 007, wake up at 0:00 go to bed at 24:00 (the same as 0:00), work seven days each week.
I suppose this blog will get around 200 upvotes before the contest actually begins. But somehow if the round gets unrated how much downvotes will it get. Any guess??
Does that sound harsh??. It might but that's the truth. 300 upvotes to 700 downvotes. That's what happened with arsijo's round.
At least show them some respect bro... they work hard to prepare the contests so we can learn something new or we can get better at something we already know.
It happened a week back
That's because Hello 2019's contribution has been halved.
Why
The contribution that you get from any post depreciates ~6 months after it is earned.
By depreciate you mean it gets halved
According to this post, "all votes for posts and comments are divided by two every 180 days". I think it behaves like "half votes" rather than "half contribution".
I hope the round would not be unrated...
Seeing this announcement,I remembered Chtholly Nota Seniorious.XD
What a warm invitation !!!!
Wish an interesting round, at least more interesting than the China Regional Qualitfier for TI9 of DOTA2, or I'll switch to that.
cn dota best dota
Congratulations for organising your first CF round! I really look forward to this contest :)
Thank you very much!
congratulations :)
Thank you!
Looks like (SukaSuka) reference. Hope the round not gonna be like the end of this anime.
"Friday evening" for Chinese, as I understand?)
Oh, yes. You are right. I am sorry, I didn't notice it:(
Oh, never mind, it is ok :)
or for Russian(
It's a big gap between two contest so far for me on codeforces.
You are experienced, so the gap will not fact i guess :)
Congratulations on the first competition you have prepared is finally about to begin.
I also want to prepare a competition in the future (time is a bit tight). QAQ
sjf ddw. (ฅ´ω`ฅ)
qianqian ddw!
csltxdy
cslnb
(〃'▽'〃)
So, does anyone else remember 897C - Загадка Нефлены? Such a pity there would be no anime pics, I liked those...
Chtholly is the best!
No, Drazil and Varda are the best :P
(It's an old picture, the Chinese words are: Normal people's CF, aces' (or maestros') CF, my CF)
QwQ 哈哈我之前看到过这张图,我觉得非常贴切呢!
Haha,I have seen this picture before.I think it's very appropriate!
Hey everyone, I'm new here. What should I do before the contest starts?
You registered 16 months ago.
Here
Instead of saying "I'm new here", just ask "Is it rated?"
Has it rated?
sjfnb!!cslnb!!!sjf ddw!!!!
Though Chinese round again... i say csl nb!!!
虽然又是中国场 但我还是要说:csl nb!!!
A good time for North America! I wish everyone luck!
gl & hf all
Why can't you have simpler names?
In div2,there are 4 games in 6 problems. sjf Orz...
Loving the GameForces
Tokitsukaze change your handle to Alice, Bob or Petya please
Please, Alice comeback from wonderland and also bring Bob back home. Bob the builder will make a nice home to you.
Your wish is my command!
So, Alice will return from Wonderland during Global Round?
disgusting. very easy problems. single fuckup -> -60 rating.
Seriously how does this keep happening? How is it possible that every other round turns into a speed contest like this one? None of the easy problems were even interesting this time, and E/F don't seem fun either :/
A<D<C=B (B considering implementation..)
We should thank god for parents who gave us such simple names
Fun to solve, not to read
Pretest 9 of Problem B might be like this : 1m 3m 5m
the answer is 1.
Yup, I missed that and realised it quite late.
Many wrong solutions passed pretests for div2 D. RIP rating.
Such as?
My solution fails on n=3 4 5 5. i guess answer should be cslnb in this case.
Ofc, there is no move for 1st player.
I used this test on two hacks, so I think this test will be in the final tests.
How to solve F? What is hack for D?
num = (cntPoints(prevX + 1, curX - 1) + 1) * (cntPoints(curX+1,1e9)+1)
, where cntPoints(l,r) — number of different x's at segment [l,r]Isn't 1 to 10^9 too huge a range to use a segment tree? Should I do some kind of compression?
You can either compress all numbers, or use compressed segment tree (which i used)
How to solve Div 2 C problem?
store all special items in an array, and keep one variable li: the last index of the page you are viewing. initially it is k. now run a while loop and in each iteration remove all elements from back of array that are less than li, if you removed t elements, li+=t; now flip pages till arr.back() (last element in array) is less greater than li (flipping page is li+=k) .
edit (thanks @spookywooky) : code https://codeforces.me/contest/1191/submission/56918688 note: idk if it will get hacked, but I dont think there are any corder cases
You could have posted the link to your code, more easy to understand ;)
use the following function: page(x,deleted) = (x-deleted)/k if ((x-deleted)%k != 0) and (x-deleted)/k-1 otherwise.
Sort all special items.
After this just use this function to delete as many as have the same page as the first item, then actualize deleted. And do it again untill all are deleted.
a map in C++ should do the job, plus the count of removed elements till now :D
How?
Can someone post the link to their code?
Add the elements to the map and say i iterate till my map size is not zero, so if my current removed element count = c, and say the element at beginning of map is a,then i remove elements from map which are less than k*(floor((a — 1 — c)/k) + 1) + 1 + c
and increment operation count and remove count.
I don't understand the fourth test case of Div1C. Whatever move player A makes, there should be exactly one card that has different side up from the rest. Why doesn't B flip that card and win, as opposed to playing for a draw?
It is not flipping but setting an interval to some value. So, this is a valid move for A 0011 -> 0011.
players don't flip the numbers, but they assign all 0s or all 1s to them, so the first player can just assign 0 to the first number, so it remains 0011.
You can flip a card $$$0$$$ to $$$0$$$. Not necessarily changed.
Yeah, after wasting a few minutes I realized that it's painting rather than flipping. I asked a "question" saying the statement is confusing and flipping means changing 0 to 1 and 1 to 0. Meh.
The first player can play to not change the state at all. Change the first card (which is already
0
) to0
.How to solve Div2-D ??
Hint: No one can get the opponent into a situation that his opponent can't make a move. (Except when n=1)
I think that the final sequence is 0 1 2 3 .... for sorted numbers before the very final move of the game, so with some boundry cases, the major part is reducing the current sorted array to that state
Solution (Div2D / Div1B)
I can give some example that you can easily solve:
Can we reduce this game to n-NIM game and can find grundy number?
"a = {1, 2, 2}", I missed such corner cases. Thanks :)
Bro can you please explain what is wrong in 56933353. I did exactly same as you said, but i am getting wrong answer on pretest 6.
You are failing in some testcases. For example, $$$a =$$$ {$$$1, 4, 4, 4$$$}. For this case, since first player cannot make his first move, the answer should be second player (cslnb). But your code outputs that first player (sjfnb) wins.
I think that's because you are forgetting the pattern that there are $$$3$$$ or more piles are initially the same number of stones.
Thanks Bro
another special case:
Second player wins because first player cannot make first move.
I have one suggestion to Codeforces.
This time, the solved of problem C was 293 though the solved of problem E was 14. I think that Codeforces should make sure to adopt at least one problem which the number of solved is greater than 30 and less than 150, to make contest enjoyable for every rating colors.
Except this issue, this contest was totally good.
In div2,this situation also appears.
The solved of porblem D was 1229 but the solved of E and F were both less than 100.I think that we should prepare problems that can differentiate the coders whose ranks are between 100 and 1500.
Despite this,the contest was really nice!
D and E -> E and F
I found a Div2D/Div1B solution(passed pretests) didn't use long long when $$$n*(n+1)/2$$$ in the last minute. Didn't get enough time to hack it. RIP my rating...
Overflow shouldn't change the remainder mod 2. How can you hack it?
The overflow happens when multiplying. This time the parity won't change, but it may after dividing 2.(Maybe?)
Okay, you need the remainder mod 4 for that, which also doesn't change.
Hmm... Anyway thank you for that.(At least I won't be so sad like this lol)
How do you solve DIV2 D?
First, check if you can move the first step:
If you can, it can be easily proved that the final status is $$$0,1,2\dots n-1$$$. Just check the parity.
Why did we have to again write ckahsdfkajsd or sufguwietqjdfgsa, depending on which player wins? Can't you use First and Second? Adam and Bob?
Bonus 2: two consecutive game problems with different things to print. In case you already remembered what means what.
Bonus 3: if something then print
quailty
...OMG, I thought it's "quality". Glad that I copypasted it.
Got WA1, thankfully it is not -50.
B
Print "sjfnb" (without quotes) if Tokitsukaze will win
C:
print "tokitsukaze" (without quotes) if Tokitsukaze will win
Just code without reading about what to print if the first player wins, then test the examples to get what to print.
#define first sjfnb
#define second cslnb
This again...
Problems would be better without printing words that are hard to spell. And how should you know what happens when you run your program. Do we have to use ifdefs and compilation flags too?
Is it just me or did anyone else just assume after reading 30<=x<=100 in Problem A that HP cannot exceed 100? Because, that's how it works in games, right? XD Hard luck!
It took me more time to read names than the whole question :) Anyway, Enjoyed the round
So does someone actually enjoy geometry tasks or are they just there to make contestants' lives miserable?
Well, geometry problems on integers and with thinking are fine. This one was pleasant in terms of precision issues but still quite standard. What I wish for sure is that they got rid of details like (0, 0) point or two points in the same position. It's so easy to make a problem slightly nicer.
Well, I think you make a very good point. I will learn this lesson and do it better next time~(First time ever in Codeforces Round)
Masochists
If having to use single acos makes your life miserable then it is a bad sign. I hastily copypasted my thousand lines geometry library but ended up using just a definition of a point, function norm and wrapper for calling atan2 (both are oneliners). I can ask the same question about neverending problems with data structures. I actually enjoy geometry problem and that one was super pleasant even for people that hate geo.
Testcase 4 for C?
Die (almost) X-P
Hope you won't fst :>
Good luck to you
Thanks!
Same here! Barely clutched it out.
Fast System Testing Start. :)
As I know, the input 3 2 3 3 can hack almost half of solution in 2D :<
I'm hacked too.
So sad :<
In this case, wich one is the winner?
Is that cslnb ?
Yes because it's impossible to remove any stone.
cslnb ?
right
what is testcase 6 in d2D?
Like this :
4
1 1 4 4 or 1 1 1 4
the answer is cslnb because it's impossible to remove any stone.
Speedforces and Typeforces :/
Though I didn't want to say so, still I'll risk saying that regardless of how the questions were, the problem statements were quite irritating for me :(
it took me an hour to solve question B , i got confused and wasted a lot of time there ... hence was only left about half an hour for other questions... wish i had thought earlier ,what i did in it after wasting hour ,it was such a easy question ;;;;
so many edge cases on problem D div2(probably i didnt get it right) :(
i hacked my own solution after locked but no one else). it Must have to fail system tests(just waiting for failation)
Kuroni nb
div2A....kancolle NB!
To be honest, this is the worst round I've been competing in Codeforces.
The problems are not determining a contestant's ability to solve problems but rather determining a contestant's ability to: [think for corner cases, hack others' solutions, read the problem statement well, distinguish between 'quailty' and 'quality', etc]. Problems should be more focused on algorithmic thinking and the ability to improve an algorithm though some problems can be focused on implementation alone.
It's not because I am bad at this round, but this is really out of my expectation.
Sorry if that's rude, no offenses, but I hate this round.
I agree with you for Div-2 ABC but I find D to be interesting, but then again there is difference between your ability and mine.
I think what he meant was that implementation part was too much in this contest, rather than to think of a cleaver way to approach a question.
Yep. For me, I think it would be better if the problems focused less on implementation/corner cases debugging.
I agree with the second and fourth ability, but it is hard for me to agree with first and third ability(especially the first one). Those are also a part of solving problems.
Last two problems seem fine, but probably most contestants spent too much time on dealing with corner cases in other problems to get to E and F :(
I think the problems are good, the bad part is output format, pretests, the order of problems and so on.
The main point I disagree with this round is that when I cannot solve some problems, I cannot solve because of bugs or corner cases. Usually, for most of the other rounds, I cannot solve because I cannot think of a better solution, or I cannot think of a way to implement something.
This is why I dislike this contest :(
i don't understand why my submissions in problem D div.2 wrong in pretest 3 but i copy it and run in my computer it show right answer
Happens at time due to different in compiler version or other such issues , try custom invocation to get exact answer that codeforces uses to validate
U really outputed "sjfnb"? No characters wrong?
I guess the reason is you used a variable as the length of an array. But due to the long queue of system testing, I can't use the custom invocation to test it.
UPD: it seems that aza-zil's comment is more reasonable.
I believe that's because you have had to initialize j with zero while you didn't, on my compiler it initialized it with 1, so on the first iteration it becomes 2 and prints "cslnb"
Div-2 D pretests probably miss a case like this : 4 1 6 7 7 since I found a solution giving 1st player to win when in this case the 2nd player is supposed to win
yes, I hacked someone with this test: 3 2 3 3
can someone please tell me what do "sjf nb" and "csl nb" mean ?!
probably sjf is tokitsukaze initials
csl is probably 2014cais01 initials
i guess nb -> 牛逼 -> strong, awesome
basically saying the winner is super great
Are you really from US?
Yep!
Besides, csl stands for the real name of 2014cais01, while sjf is stands for Shi Jin Feng. So what does Shi Jin Feng mean? It's a character in a Japenese game, whose Japenese name is tokitsukaze. And the Chinese name of tokitsukaze is Shi Jin Feng, so tokitsukaze-->sjf.
This is tokitsukaze (SO CUTE)
By the way, nb stands for “牛逼”, and I consider that the better translation of it are supposed to be shit(for praise) or dope, since 牛逼 is a sort of bad language in Chinese.
This round should be Educational))
It's like "come to CodeForces and learn some new (and very cute indeed) japanese anime characters"
So cute that you change your profile picture? XDD
Yup, it fits well, at least by color)
I don't know why my solution for problem D got WA on pretests though I see I have considered all the cases according to some AC'ed solutions. Can anyone point it out ?
Edit : I got it.
How to solve Div1D/Div2F?
I see that many people dislike your problems, in contrary, I really enjoyed C and E. F also would be nice, but why $$$10^{18}$$$? Why test depth of our library, not our knowledge? I seriously considered hacking other people instead of writing F just because I don't have prewritten factorization.
F is to against Baby-Step-Giant-Step. It was $$$10^{12}$$$ (for 1D) at first, and then we realized it's similar to $$$10^{18}$$$ (for 1F), which is more impossible to pass by solution in $$$\mathcal{O}(\sqrt{n m})$$$.
$$$10^{16}$$$ would be enough to break $$$O(\sqrt{nm})$$$ but allow $$$O(\sqrt{m})$$$ factorization.
Yeah, but it will be a 1E. And the setter for 1E at present doesn't want his problem to be more difficult, so... T_T
I don't see how demanding fast factorization increase difficulty of this difficult problem. Obviously all participants who have a chance to solve this know about existence of fast factorization algorithms. So you just ask "OK, you solve the problem. Do you have prewritten factorization?"
Whenever i copy a solution from codeforces and paste it on any editor and compile it, it shows stray in the program error example, can anyone tell me the reason why is it happening.
These CE errors indicate non-ascii characters in your code. Most likely unseen special whitespaces, in your case. Try deleting them following the line number and position given by the CE message then retry.
Is 912 not a triplet ? In probelm B Div2
No, it is specified in the problem statement
Yes its not a triplet since any permutation of 9,1,2 does not contain consecutive numbers
Am I missing something or in Div1 B rules don't exclude two players winning simultaneously?
If the piles are [$0, 1$], then first player loses because after his move there are two same pile sizes, but also second player loses because before his move all piles are $$$0$$$.
I asked a question and received a clarification that first loses in this case. Is it just "by convention", or it's written in the statement somewhere and I can't see that?
After the first player plays, he looses. The first player looses at the end of his turn, before the second player tries to play.
Fantastic contest. No advanced algorithms or DS required , at least, for the first 4 problems in div 2 yet the difficulty is balanced. pretty creative
also div2 e problem, you just need a binary search.
congratulation to cerberus97 for becoming International Grandmaster.
2nd question was much complex than and lengthy than third question
Something about div2a (I think nobody cares)
This is a system called Player Ship Protection Mechanisms(轟沈ストッパー in Japanese, 沉船保护 in Chinese)
When damage is greater than remaining HP, this protection will be triggerd. Actual damage formula is as follows. HP refers to remaining HP.
$$$ \text{Damage} = \left \lfloor \frac{HP}{2} + 0.3 * \big ( \text{randint} \in \left [ 0 , HP \right ) \big ) \right \rfloor $$$
According to this formula, HP in the form of 4n is most likely to be heavy damaged(remaining HP ≤ 25%, also called 大破 or taiha) from full HP in one hit, which is an important state in this game.
Although the influence of the form of max HP is not absolutely, it is usually considered 4n+3 is the best form and 4n is the worst form, which is different from this problem.
By the way, the way of increasing HP limit in the game is getting married(仮). But player can't decide the amount of increased HP limit. The amount is decided by ship type and model. (This is a problem! Don't be so serious!)
Further reading:
https://kancolle.fandom.com/wiki/Combat/Damage_Calculation#Player_Ship_Protection_Mechanisms (English)
https://wikiwiki.jp/kancolle/%E6%88%A6%E9%97%98%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6#h2_content_1_13 (Japanese)
https://zh.kcwiki.org/wiki/%E6%88%98%E6%96%97#.E5.85.B3.E4.BA.8E.E2.80.9C.E9.98.B2.E6.B2.89.E4.BF.9D.E6.8A.A4.E2.80.9D
https://zh.moegirl.org/zh/%E8%88%B0%E9%98%9FCollection/%E6%88%98%E6%96%97#%E8%A2%AB%E5%BC%B9 (Chinese)
Yes, you are right. I came to promote this game. KanColle hajimaruyo!
Oh, I don't have much research on this problem. In my impression, 4n+1 is the best:3
btw, I don't know if you found out, 2C/1A is also based on KanColle.
Handing over quests? emmmm I think that's a bit different if click from top to bottom.
discard equipment? (by google translation)
Ah, I got that.
When will the editorials for the problems be published?
Soon.
This was fast. Thanks
why does ceil(394779268306930212.0/394779268306930211.0) produce 1 as output?
By default ceil takes double argument.
ceil((long double)394779268306930212/394779268306930211) (gives 2)
I am not able to understand Div 2 B Please Help
I'm sjf and csl.