Блог пользователя Ahmad_Elsagheer

Автор Ahmad_Elsagheer, 9 лет назад, По-английски

Hello Codeforces!

I would like to invite you to Codeforces Round #417 that will take place tomorrow on June 1st, 2017 at 17:05 MSK.

This is my first round. Great thanks to KAN for his efforts and help in the round preparation, mike_live and 300iq for testing the problems, and MikeMirzayanov for the awesome Codeforces and Polygon platforms.

The round is rated for the second division. Participants from the first division can take part out of competition. As usual, the participants will be given 5 problems and two hours to solve them.

I hope you will find the problems challenging and interesting!

UPD 1: Scoring disrtibution: 500 — 1000 — 1500 — 2000 — 2500.

UPD 2: Due to a technical issue, the contest is delayed by 10 minutes.

UPD 3: Contest is over. Congratulations to the winners!

Div2 Winners:

  1. TERESO

  2. neverfirst

  3. _luckyE

  4. zstu_jack

  5. jiyutian

Div1 Winners:

  1. y0105w49

  2. _Reborn_

  3. eddy1021

  4. chemthan

  5. KrK

UPD 4: Editorial

  • Проголосовать: нравится
  • +361
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -26 Проголосовать: не нравится

After JBMO TST (Junior Balkan Mathematics Olympiad Team Selection Test) I will participate in that contest. Hope short and interesting statements :D

Good luck!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -6 Проголосовать: не нравится

Thank you for preparing the contest and I wish that it will be a nice contest with interesting problems.

BTW I'm curious to know how the problem-setter is an Egyptian while the testers are Russians ? :D

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +2 Проголосовать: не нравится

Why this blog is not seen in the home page?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

You did really well in the WF, so we must be expecting some interesting tasks :D

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

No character ? It seems to have short statements :DD

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +57 Проголосовать: не нравится

That will be my birthday. Can I lose 6 points off my rating before the contest as a birthday gift? So that it can be rated for me. :D

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +22 Проголосовать: не нравится

By the way, the time link in your post is wrong, it says 5:05 am MSK (it should be pm).

»
9 лет назад, скрыть # |
← Rev. 8  
Проголосовать: нравится 0 Проголосовать: не нравится

What about a "Rated" Div 1 contest?

»
9 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +1 Проголосовать: не нравится

The link for the time of the contest in the "Contests" tab redirects to World Clock instead of the actual event timer.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +21 Проголосовать: не нравится

It seems that codeforces system automaticaly unregistered some people that had been registered earlier!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

Good luck everyone!

Shameless Promotion: I have developed a cli tool to ease problem testing during contests (for newbies like me) you can read about it here. http://codeforces.me/blog/entry/52234

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

the time link nowadays is not showing regional time. previously it was showing your regional timing BTW ,excited about this comtest.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

hey, it's 14.05 here and the contest is not live yet.I also got mail related to unusual start time .Why isn't it start yet?? Pls, fixx this problem ...I already miss two contest due to this:((

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

Is site working slow for all? or Is it just my network?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

Something weird things happens in Codeforces..

It unregistered me...

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Три минуты назад:

Надеюсь во время раунда будет всё ОК)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Delayed by 10 minutes :o

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

delayed by 10 mins :P

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +51 Проголосовать: не нравится

It won't be a normal Codeforces round if it is not delayed :)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It's been so long since the last time I have seen the score distribution BEFORE the contest.

GL & HF everyone.

:)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -16 Проголосовать: не нравится

Due to a technical issue, the contest is delayed by 10 minutes.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

Please, Don't delay the contest more than 20 min because of maghreb Prayer " E7na saymen y3ne" :"D

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

It's very exciting!!! Good luck to myself

»
9 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +1 Проголосовать: не нравится

I wish i had a time machine!
Time+=10minutes

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -10 Проголосовать: не нравится

It shows registration is completed still the number of users registered are increasing??

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hope this round will be interesting!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -36 Проголосовать: не нравится

Polite Enquiry, Looks like after january , codeforces has lost it's original Rounds, after appointing KAN as the co-ordinator, CSAcadmey is doing good in preparing problems of homogenous/regular difficulties.

CF ROUND GOING TOO IRREGULAR

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится

    I don't know if this fact is related to KAN becoming coordinator, but it is a fact indeed. We should have increasing scores to match increasing difficulties; and this rule hasn't been true recently...

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

Very strange scoring distribution / problem ordering

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Many hacks in A

»
9 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +5 Проголосовать: не нравится

I don't why for the 3rd question, I was solving a[xj]+(i*xj) where i is the index of the chosen array element in the k chosen element(i ranges from 1..k). Took me by surprise looking at the increasing number of submissions. Wasted so much time over it :( PS: Can anybody tell me how to solve the question i thought C was

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Me, reading problem D

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +52 Проголосовать: не нравится

Problem E is just Staircase Nim. Nodes can be classified as two types, the "odd steps" and the "even steps" depending on the parity of their depth. The odd nodes are the ones having parity of depth same as that of leaves. The others are even nodes. Player 1 will lose iff the XOR value of all odd nodes is 0.
So, if you swap the value of an even and an odd node, you need to ensure that the resulting XOR value of odd nodes becomes 0.
Additionally, if the initial position is losing for player 1, then you can swap any 2 even nodes or any 2 odd nodes too.

Code

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Task A is very good problem for hacking. Task C is easier than B. Task B is above my strength. I thought about brute force, greed with bfs from every rooms where light is on, but it won't work... So, how to solve it?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

It seems more like A-C-B-F-D !

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

Отвратительный контест. Задача А — "пойми условие за минимальное число прочтений". Задача B — "победи в себе отторжение и все-таки напиши очередной перебор без идеи". Очень хорошие задачи, так держать!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

how to solve C?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

@Ahmad_Elsagheer why such an irregular scoring distribution

  • »
    »
    9 лет назад, скрыть # ^ |
    ← Rev. 4  
    Проголосовать: нравится +17 Проголосовать: не нравится

    The swap between B and C is strange a little bit. Regardless of implementation and easy greedy problems, I believe that brute force should always be the simplest among others, as you exert no effort thinking about the optimal solution, you just try everything in the search space. That is the first thing I learned in competitive programming "brute force". I found that people always underestimate brute force (specially backtracking) solutions, however, a participant who can solve B efficiently should be able to solve it (DP solutin is not intended of course so n ≤ 15). I think the main problem is that people who started their competitive journey from Codeforces problems only didn't face such brute force problems a lot, because most of the problems will need simple nested loops.

    Regarding D and E. If I found these two problems when I was Expert, I would have solved D only. In problem E, this variant is not an easy one to think about if you know only standard nim game. If you find it easy, then you are brilliant, but D should be easier. The point with problem D is the modelling part. It needs careful reading as it has many conditions. It's the deadlock problem but with conditions to make it on a tree not a general directed graph. People who gave it a try but didn't solve it told me they thought it was a DAG not a tree. Reading the statement over and over again, I found written "No child can request a toy while waiting for another". This implies that each node has at most one outgoing edge. So, the DAG now becomes a tree! If anyone could figure this out, it can be written in 10 mins.

    In conclusion, this is not the standard Codeforces problem style. You can go through the gym and check the problems there. Your find different regional contests and training camps. Each of those has its own style. However, knowledge and experience required to solve the problems at the end is the same.

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится

    As an author, you always try to make a good contest by making a gap between problems. However, this gap is not always clear when you write the problems yourself specially when it is a new experience. I hope next time it will be better. But you can't always make all people satisfied. It's life, man.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is there short solution for B?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -10 Проголосовать: не нравится

Ordering should be A — C — B — E — D!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +69 Проголосовать: не нравится

To me A was the hardest among A, B, C, E, as I still don't get what the problem is saying till now.......

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Will simple recursion without dp pass TL in B?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

For A,a guy in my room was printing "Yes" instead of "YES",did the same for "NO" too. Tried hacking and failed. Isn't printing "YES" and "Yes" different?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

Damn problem A is really my favorite problem of ALL time ! I did my really first hacks (4 hacks in this contest) in this problem alone.

I'm really sorry for my friends in my room that got hacked by me.

for me the problem explanation is really clear. Easy problem, but people might misread the explanation.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

what was pretest 6 in C? :'(

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

That feeling when you submit A and get pretests passed and right after there's a sudden power outage... Bye bye rating.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

I'll maybe get downvotes for saying this but I really did not enjoy this contest. The problems were not interesting to solve — just extremely annoying.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

test 6 in problem E ?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

I understood problem A only after reading it 5-6 times...

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

The problems weren't ordered by their difficulty, were they ?

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

The queue of submissions in the end was long. I submitted 7 minutes before and the it was evaluated after the contest.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

Задача А является наверное самой бредовой задачей за всю историю раундов Codeforces...

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

Контест ниже плинтуса. Суть всего контеста это понять условия, а не решить задачи

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Solving B first was an extremely costly decision for me. I should have rather started with C.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

I solved C using greedy but failed in TC 6. Any Help please

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It was not a very good contest at all, though i think problem C is a really nice one.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

i think B is harder than C it was a waste of time not to start with C after A

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What is the hack in problem A?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

It's hard to understand A and D. I guess I should practice English more.

That aside, D looks really fun to solve. The other 4 are quite classic (I think), and yet I f*cked up really bad.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +32 Проголосовать: не нравится

812A - Sagheer and Crossroads worse statement ever !! It needs more description

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What will be the answer of this test case in 'B'
1 11 01000000010

Is it 9 or 4. From what I learnt from the problem statement is that we can move from one stair to another stair on the same floor?

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Does anyone know why I kept getting WA on Problem C pretest #11 with this code? My idea was to just binary search for the highest k value. On each iteration, I updated the array to the new costs and then sorted and took the k smallest elements.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

fainted from reading Problem D at mid night.. :D

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Wow , very fast judging :D

»
9 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +1 Проголосовать: не нравится

By getting hacked on Problem A, I feel that if I (and many others ;) ) were to monitor the configuration of the traffic lights in the real world, so many people will get killed by accident XD

On a serious note though, thanks for hacking my solution, cswyyv864. If I didn't get hacked I would've just gotten 0 for it at the end lol

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +6 Проголосовать: не нравится

Problem A: ?????

this problem destroyed your work on the other probs!!!

  1. Bad statement it should have been mentioned that each lane goes to what part -_- my solution got hacked coz I did not concentrate on how the cross road really work :v
  2. the rest of the probs are interesting, thanks.
»
9 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Systesting today is really fast

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +25 Проголосовать: не нравится

very bad contest

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится

Sad to see that N^2 log(N) also passes for problem C :(

Here, have a look!

http://codeforces.me/contest/812/submission/27499338

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +63 Проголосовать: не нравится

I swear I'll never underestimate Div2-A again...

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +123 Проголосовать: не нравится

One of those contests where you think you want to ask for a clarification but don't even know where to start.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Compiled E, just 1 sec before contest ended. Hope I don't get AC later.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +40 Проголосовать: не нравится

This guy literally crushed all the pedestrians xD

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +54 Проголосовать: не нравится

 you got this...

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

Problem statements were very unclear! One reading was not sufficient at all :(

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

in C atleast one ex should be given to clearify which index is xi's. i spent 25 minutes figuring out what's wrong

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Weak pretests for A :|

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

you don't actually need DP to solve B , it's overkill ..... the problem can easily be solved with straight forward Brute Force in a recursive function .... anyway ,thanks for the problem setter i think the problems were nice, keep up the good work!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

7 претестов для задачи А, из которых три — сэмплы. Класс)))

»
9 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +2 Проголосовать: не нравится

deleted , sorry my mistake :3

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Good contest.Although I think the statement for some problems is too long or unclear,the quick system test and quick editorial are worth appreciating.Thank you Ahmad_Elsagheer for preparing the wonderful contest!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

Solution to Problem D is wrong. Consider the following test case:

4 7 9 3 4 5 4 6 4 7 1 1 1 2 2 1 3 2 4 1 4 2 1 5 2 6 3 7

The solution gives 4 0 2 as result, which is obviously wrong.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Goddamn, I got WA in B because i accidentally used && in bitmask instead of &, I hate such situations((

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -31 Проголосовать: не нравится

MikeMirzayanov[user:MikeMirzayanov] please don't give another chance to this question setter

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +36 Проголосовать: не нравится

    What the hell ???

    I mean this wasn't the greatest round of all time but don't you think you're being too harsh.

    You are right there were a few problems but the guy did his best and this is his first round cut him some slack will ya ?

    I think if the statements were clearer and the pretests for A were stronger this would have been a great contest it wasn't that bad.

    :)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Only neverfirst solved all problems. This is great result!

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +12 Проголосовать: не нравится

https://ibb.co/bZ5YJF Such proof! Much Wow. xD

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone explain, why in this test case 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 in problem A jury answer in "NO"?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

nice contest

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I don't get the rating system. Can anyone explain how it works? I solved A task in 36 min and got -22 rating pts. Is it because my solution was sent too late?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +24 Проголосовать: не нравится

Well, actually once I was first also alone solving all problems. Someone can post standings for this contest. If there will be +100 I will post it myself.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -14 Проголосовать: не нравится

Mike mirzayanovCF should follow csacademy in terms of problem statements.

»
9 лет назад, скрыть # |
← Rev. 6  
Проголосовать: нравится 0 Проголосовать: не нравится

please consider the following case in problem B

10 10
001110010110
000000000000
011000000010
000000011000
001010101010
000000000000
000000000000
000000000010
010000000000
000010000000

the code which you posted here http://codeforces.me/blog/entry/52318

gives an answer of 73 while it could be just 61

using the above inputs you can check the code you wrote and it gives 73

using the following sequence by following the shortest path and using only stairs for moving up and down shows how it could be possible for just 61

  0    0  (11) (12) (13)   0    0  (14)   0  (15) (16)  0
  0    0    0    0    0    0    0    0    0    0    0   0
  0  ( 9) (10)   0    0    0    0    0    0    0  (17)  0
  0    0    0    0    0    0    0  (19) (18)   0    0   0
  0    0  ( 8)   0  ( 7)   0  ( 6)   0  ( 5)   0  ( 4)  0
  0    0    0    0    0    0    0    0    0    0    0   0
  0    0    0    0    0    0    0    0    0    0    0   0
  0    0    0    0    0    0    0    0    0    0  ( 3)  0
  0  ( 1)   0    0    0    0    0    0    0    0    0   0
( 0)   0    0    0  ( 2)   0    0    0    0    0    0   0

this case i made randomly to check my algorithm and to check wether it provides a right answer like yours or not

and please correct any pretest that have this mistake -If it was a mistake- and maybe I am wrong if so please enlighten me

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +6 Проголосовать: не нравится

    "He wants to turn all the lights off in such a way that he will not go upstairs until all lights in the floor he is standing at are off."

    Your solution goes to the second floor before turning off all the lights on the first floor.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can't problem C be solved by using DP? my initial thought was that it can be !!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

and (( neverfirst )) won the second place :)