mohammedehab2002's blog

By mohammedehab2002, history, 2 months ago, In English

Hey everyone!

I'd like to invite you to participate in the ECPC 2019 Kickoff contest on gym on Wednesday, 08:30 UTC. The contest was originally held in Cairo in 2019, and we woke up today and decided to publish it.

The problems were created by me, DeadPillow, KhaledKEE, Mohammad_Yasser, Dark, and Jester. The contest will include 14 problems, and you'll have 5 hours to solve them.

We hope you enjoy it :D

Announcement of ECPC 2019 Kickoff
 
 
 
 
  • Vote: I like it
  • +74
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it +27 Vote: I do not like it

PS: Osama_Alkhodairy was a tester.

»
2 months ago, # |
  Vote: I like it +14 Vote: I do not like it

Thanks for uploading contest in gym! But i have 2 questions:

1) Is it team contest?

2) Is it suitable for master(s)?

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it +9 Vote: I do not like it

    1) Yes

    2)During the official contest the top 3 teams consisted of masters and one of them had a grandmaster however none of them solved all the problems (not going to say how far they were thou) so yes even grandmasters will have fun participating.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks again!

    • »
      »
      »
      2 months ago, # ^ |
      Rev. 2   Vote: I like it +8 Vote: I do not like it

      Where can I find the official scoreboard and the editorial of this contest?

      Note: thanks for uploading the contest, my team enjoy to solve the problemset

      • »
        »
        »
        »
        2 months ago, # ^ |
        Rev. 2   Vote: I like it +23 Vote: I do not like it

        Congrats for the win!

        So there's no detailed scoreboard, but the top 3 teams all solved 11 problems, and they were mostly masters and 1 GM. We didn't prepare an official editorial, but I'm guessing people will discuss the solutions in the comments. I see no teams solved I, so I'll start the discussion with its solution.

        I's solution
»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve problem K, please?

  • »
    »
    7 weeks ago, # ^ |
    Rev. 2   Vote: I like it +18 Vote: I do not like it
    Solution for problem K
»
7 weeks ago, # |
Rev. 8   Vote: I like it +15 Vote: I do not like it
Solution for problem J
Solution for problem E
Solution for problem C
Solution for problem D
Solution for problem H
»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the expected solution to H?

  • »
    »
    7 weeks ago, # ^ |
    Rev. 2   Vote: I like it +19 Vote: I do not like it
    H's solution
»
6 weeks ago, # |
  Vote: I like it +6 Vote: I do not like it

How to solve problem B?

  • »
    »
    6 weeks ago, # ^ |
    Rev. 7   Vote: I like it +2 Vote: I do not like it

    It is obvious that we should increase the length of a shortest side of the triangle. You can calculate the optimal increase using ternary search.

    Code

    • »
      »
      »
      6 weeks ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      wow, I was doing 3 ternary searches to check which side I should increase.

      For some reason something went wrong.

      thank you!

      UPD: I changed this line in ternary search:

      (f1 < f2) ? l = m1 : r = m2;

      to this:

      (f1 > f2) ? r = m2 : l = m1;

      and I got accepted

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it +22 Vote: I do not like it

    It also can be solved without ternary search: for two fixed triangle sides $$$a$$$ and $$$b$$$, the area is maximized when the third side is equal to $$$\sqrt{a^2 + b^2}$$$, that is, the angle $$$\alpha$$$ between $$$a$$$ and $$$b$$$ is $$$\frac \pi 2$$$. This is because the area is equal to $$$\frac 1 2 a b \cdot \sin{\alpha}$$$. Using this, we can just get as close to this value as possible.

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

can anyone please explain how to solve L?

  • »
    »
    6 weeks ago, # ^ |
    Rev. 2   Vote: I like it +14 Vote: I do not like it
    L's solution
    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      I solved problem L using relation $$$E((x+1)^2)=E(x^2)+1+2*E(x)$$$, if we generalize this relation for $$$K$$$ , we can use binomial expansion to calculate $$$E(x^k)$$$ from $$$ E(x),E(x^2)....E(x^{k-1})$$$.

      `

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve problem F? I couldn't get any further after simplifying the sum to $$$ (m1) \times(\sum_{x=l}^{r}((m2 \times x )+ x)-\sum_{x=l}^{r}((m2 \times x) AND x))$$$ where m1 is the minimum slope and m2 is the difference between the two slopes.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The expression boils down to sum( (x<<s1) ^ (x<<s2)). Lets count for every power of two how many times it appears in the expression, fix the power of two K, and now we need to count how many binary strings less or equal than X exists such that exactly one bit from {K-s1,K-s2} is on, its classic dp on digits.

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I try to submit this code several times but i get wrong answer in pypy2 but it run in my pc can someone help me to get this code accepted in pypy2?

»
6 days ago, # |
  Vote: I like it 0 Vote: I do not like it

in problem M i take input with this way inp=open('lis.in','r') but it gives me RTE what is wrong and sorry for my bad English

  • »
    »
    6 days ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    i just add .strip() to second line and it get accepted Your code because when you add strip to readline() it remove '\n' this character from the string .

    hope it well__