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

Автор mohammedehab2002, история, 6 лет назад, По-английски

Hi!

Codeforces round #628 (vintage Codeforces round #2) will take place on Mar/14/2020 17:35 (Moscow time). It's rated for the second division, but, as usual, first division participants can take part out of competition.

The problems were created by me. I'd like to thank, and orz, antontrygubO_o for coordinating the round; ramchandra, pajenegod, aryanc403, taran_1407, Kuroni, robert9524, dorijanlendvaj, Andreasyan, 300iq, zoooma13, Osama_Alkhodairy, Mohammad_Yasser, and TripleM5da (special shout-out) for testing the round; and of course MikeMirzayanov for the great codeforces and polygon platforms.

You'll be given 6 problems and 2 hours to solve them.

UPD: the scoring distribution will be 500-750-1250-1750-2500-2750.

UPD: the editorial is out.

UPD: congratulations to the winners!

Div.1:-

  1. tmwilliamlin168
  2. EvenImage
  3. Um_nik
  4. imeimi
  5. HIR180

Div.2:-

  1. davooddkareshki
  2. rainboy
  3. PouyaNavid
  4. _Lucien
  5. socho

Good luck & Have fun!

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

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

Good to see Round pi*200 on pi day.

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

Are you sure you're going to be available on that day?

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

I'd like to thank, and orz, antontrygubO_o

inb4 anton quits coordinating rounds like he quit AC

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

tau is superior

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

Another contest by one of my favourite problem setters — mohammedehab2002. I'm going to revise XOR problems to prepare !

UPDATE — I will lose ratings but I enjoyed the hell out of it ! Thanks mohammedehab2002 for preparing an excellent contest and I hope to see many more from you in the future !

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

make the problem description short like the announcement ^_^

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

Most of the Problem title would look like 'Ehab and bla bla bla ....'

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

orzing is forbidden

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

what do you mean by (vintage Codeforces round #2) ?

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

*le xor problems
here we go again.

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

If i registers for contest. But will not give this contest. Will it affects my rating?

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

I think you missed this:

مرحبا كودفورسز (hello codeforces)

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

xor problems, here we go again.

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

Is it rated till 1900 or 2100 ?

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

I hope the the expected XOR Problem is replaced by a constructive or number theory problem. orz

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

1)

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

Is it rated?

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

Hello. Can you please reschedule the round for 12 hours (Moscow time), in connection with the holding of another Olympiad at 15:00 (Moscow time). Thanks in advance

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

Hello. Can you please reschedule the round for 12 hours (Moscow time), in connection with the holding of another Olympiad at 15:00 (Moscow time). Thanks in advance

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

Get ready for more XOR problems !

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

Can the contest be delayed 1 hour please because I wouldn't be available at this time. mohammedehab2002

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

    Hello. Can you please reschedule the round for 12 hours (Moscow time), in connection with the holding of another Olympiad at 15:00 (Moscow time). Thanks in advance

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

    Hello, aihay.

    Ah, i see, Mike didn't discuss contest timing with you this time. Forgive him, he's a bit busy preventing corona from spreading through CF, you know.

    I'll make sure this will not happen again! My apologies for this awful inconvenience. CF stuff will be punished, I promise!

    Hope you like the new timing! If you have any other problems with CF feel free to DM me!

    Best regards, kostia244

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

Will this contest effect my rating ....if my current rating is 1255,._???

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

Xor here u are

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

Waiting for interesting problems as expected from you

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

Hope that I can solve ABC <3

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

Короновирус короновирусом, а кф по расписанию

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

Seeing the score distribution: 500-750-1250, I think the difficulty gap between A and B will not be as big as other contests.

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

It's exciting that Codeforces is holding more and more vintage rounds (ʃƪ ˘ ³˘)

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

Why a lot of comments are about XOR-problem. Could you explain me this joke

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

Lets starts xorforces...

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

owee great new XOR problem is coming ... :)

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

Maybe today I will reach master before CoronaVirus reaches me :D

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

tedesjo fire ||| _ __ _ ## (_ " + __ _ )) )) + || | | _+ _

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

15600+ registration! Get ready for long queue! O_o

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

Deleted

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

timelimit on c with O(n) with python :(

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

MathForces > ArrayForces

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

I did A and B in 30 minutes, still my rating is going down, C is too much for me, oh well.

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

As expected , Another xor problem D.

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

When I submit, the output that is on your testing is different from the output when I run the program on my computer. How do I fix this?

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

How to solve C?

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

    set smallest numbers to edges to leaf, and others randomly)

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

      You would have to take care that the parent on the leafs where you place the edges 0 and 1 is not the same vertex. Because if it is, that MEX will be 2 instead of 1.

      Edit: It turns out I am completly wrong with this. There is no need to take care for the parent. The only thing to take care of is not placing the edge 2 between the edges 0 and 1. For that it is perfectly fine to simply place the numbers 0,1,2 in leaf edges.

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

    If it's a chain, then fill all the edges randomly.

    Otherwise, choose a node of which degree is 3 or above, fill three of the edges using 0, 1, 2; others random.

    It can be proved to be one of the best answers.

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

    Here's what I did : Sort all vertices by their degree in descending order. Now, starting from the vertice with the maximum degree, try and fill all its unfilled edges with numbers in a serial manner( Maintain a count variable. Fill edges with the count variable and increment it everytime you fill an edge )

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

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

How to solve problem D?

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

    I tried to construct bit by bit, starting at lowest bit and the xor input. Then add bits to get the sum, by adding the one lower bit twice to two numbers in the array. And so on...

    Did not work for some reason.

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

    max length of the answer is 3

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

    The answer is at most 3 or it is impossible.

    If $$$u$$$ and $$$v$$$ don't have same parity or $$$u \gt v$$$, it is impossible.

    If $$$u=v$$$ the answer is $$$0$$$ if $$$u=0$$$, $$$1$$$ otherwise.

    Otherwise, try to build a pair which xor gives $$$u$$$ and sum gives $$$v$$$. Let $$$t=(v-u)/2$$$. If $$$u$$$ and $$$t$$$ don't have any bits in common, a pair of solution is $$$u+t$$$ and $$$t$$$.

    Otherwise, $$$t$$$, $$$t$$$, $$$u$$$ is a solution.

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

    Look at the bitwise representation of $$$u$$$. Every bit that equals 1 means that there is an odd # of elements with that set bit. Every bit that equals 0 means there is an even # of elements with that set bit (because 1^1^... odd number of times = 1, 1^1^... even number of times = 0). So one of the array elements is at least equal to u. Suppose first element of array = $$$u$$$. Then we have to add two elements such that we don't change the parity of set bits; i.e., we must add two of the same element, call it $$$y$$$. This is 3 total. But then we can consolidate one of the $$$y$$$ into $$$u$$$, iff $$$u$$$ AND $$$y$$$ equals 0.

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

      I had this idea, too. if u-v is even, add (u-v)/2 twice. But how does it work if u-v is odd?

      We cannot add both numbers, because one bit will be set wrong then.

      Edit: Fuck it, the parity of u and v is same! I had this before, checked and output -1. So, if the parity is same, the difference is allways even. The odd case does not exist.

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

    You can make array of one element if the XOR value equals to SUM,

    the one's bits in XOR must appear in odd numbers in array.

    so we can make array of two elements if the following conditions comes true,

    one of the two numbers has the one's bits in XOR

    and the remainder rem = (XOR — SUM),

    can be distributed among two numbers (must be half in the first and half in the second to get XOR ZERO)

    and the XOR of those two number must be the same of XOR in the input

    and you can make array of three elements if the following conditions comes true,

    one of the three numbers has the one's bits in XOR

    and the remainder rem = (XOR — SUM),

    distributed among the other two numbers equally to get (XOR zero) when XOR them,

    so when we XOR the input with zero we got XOR.

    otherwise there is no answer.

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

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

Me after solving ABCD:

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

what is test case 18 in problem D

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

Is: (a + b + c) = (a XOR b XOR c) + 2 * (a AND b AND c) ?

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

is E shortest cycle detection after reducing prime divisors to a graph?

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

How to solve C & D?

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

How to solve the case in E, when you must find the shortest cycle in the graph? :c

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

    Disclaimer: I don't have an accepted version yet.

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

It is rated?

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

How to Solve C?? Is there any Pattern ?

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

    Label any 3 edges, which connects a leaf vertice, with 0,1,2

    You can label other edges with any numbers avaliable.

    If the tree is a chain, all of the labeling way are acceptable.

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

    if you find one node like x that has 3 neighbors then use 0,1,2 for labels of edges between x and neighbors and you can chose labels of other edges in any order and you will get MEX(u,v) = 2

    if you can't find node like x then chose all labels of edges in any order and you will get MEX(u,v) = n — 1

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

How to solve D?

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

Was problem F related to finding if the graph is triangler graph?

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

For problem C - I took number of leaf nodes of the tree count and assigned count to n-2-count to those edges and remaining values to the nodes with children. Was I wrong?

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

So, how do you solve E?

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

Please help me in solving question D. Thank You.

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

Does anybody know how to solve F?? i thought the articulation point.. but i can't solve this

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

The editorial is out. It's the fastest editorial I've ever seen. Orz

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

E:

We can divide every number by square of a prime until it is a product of primes. If there is an $$$1$$$ or 2 indices with the same number, we already found an answer.

Also observed that in each number there will be at most one prime larger than 1000.

What can be done next to get the solution?

UPD: seems I miss that its "divisors" not "prime divisors", thanks editorial.

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

Hey, can anyone please tell me the total hacking time for this particular contest?[contest:628][contest:628(Div2)]

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

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

Strangely, I started to read coronavirus instead of codeforces :o

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

Other Solution for C:

count = no of leaf node(node with degree == 1)

if(count >= 3):set any three leaf node to 0, 1, 2 that will set the upper boundary for MEX to 2

because any path in tree can have maximum 2 leaf nodes

if(count < 3) arbitary

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

Can anyone help with what is problem with test 143 in E? Its too large to debug by hand, and I can't find small counter to my code...

My code: https://mirror.codeforces.com/contest/1325/submission/73272537

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

Lol. Didn't solve D because I didn't consider just 1 case: if(u == v) {cout<<1<<'\n'<<u; return 0;}

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

My Java solution for E passed in 2979 ms. Talk about scraping the time limit.

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

Is this solution (73271134) for F hackable, or is it accidentally correct? I sort of combined both of the editorial solutions without understanding either of them.

First, I attempt to find the independent set with exactly the editorial's "A solution using degrees" algorithm. In a set, keep a list of (degree[i], i) pairs, and keep taking the node with minimal degree and invalidating each node's neighbors, updating the degrees of the neighbors of each invalidated node in the set.

The if (n <= 16) brute-force part is only there to counter some of the manually generated edge cases, which tend to be small.

Then, I run DFS from random starting nodes. This DFS runs in arbitrary order, and when it hits an ancestor in the DFS tree, checks if the cycle is long enough/prints it. It runs until it either finds an answer, doesn't, or TLEs (might be $$$O(n^2)$$$ at worst).

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

is it just me or has codeforces slowed down on the contests! The next one is after 5 days! :(

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

Hi, i was banned for copy pasting. But it's system error :) There are some reasons, why it is impossible to stole his solution: 1) Code is really simple and there were too many participants, that's why chance of two similar codes is really hight 2) I am from Russia, he is from France))) 3) Also i wrote him, and i believe, that he will agree with me, because it's really strange, i didn't know him before this :| Thank you for your attention and i hope that you will solve this problem, because it's really sad(

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

Can anyone explain me Problem C. i am not able to understand it.

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

    Consider the paths between all nodes. If the edge with value 0 is not on such a path, the MEX of that path is 0.

    So, consider the paths with the 0. The MEX of these paths is 1, except if the edge with value 1 is also in this path. Then it is at least 2.

    So, is it possible that there is no path with edges 0 and 1 in the path?

    It turns out, no, that is not possible. Since by the simple fact that the path from two nodes of the edges with value 0 and 1 has both edges in it. So it allways exists.

    But now we are close to the solution. How can we place the edge with value 2 in a way that it is not on that path, too?

    Well, more or less simple, we place that edge not on the path between the edges 0 and 1. Then it is not.

    Last question to answer is, how do we implement this, how can we find suitable vertex and edges? The tutorial answers this clearly: We search an vertex with at least 3 edges, and use these 3. Then the edge with value 2 will not be on path between the edges 0 and 1.

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

Nice Contest <3 :)

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

I like how all Ehab contests are based on intense maths and number theory.

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

Few Hour ago i got a message from System. I'm sharing it here.

**Attention!**
**Your solution 73232959 for the problem 1325B significantly coincides with solutions sazidnur/73232959, secsee/73233935. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://mirror.codeforces.com/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.**

My PC is too slow. So i use ideone to compile my code and also i feel comfort at online IDE but I've made a mistake. Today's morning (Bangladesh Standard Time), By mistake I change my code sharing option private to public and i didn't notice this before contest. So someone got my code on internet. I admit that it's my fault and also i promise that, I will never make this kind of mistake again.

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

I don't know why but my submissions from that contest are still shown as pretests passed. Moreover, all of them were evaluated as failed attempts. And my rating has dropped :/ I firstly thought maybe system evaluated my submissions like I cheated. However, I did not receive anything regarding to that. Can someone check this?

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

Really amazing and Mathematical contest. Loved it.

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

.