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

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

Hello, Codeforces!

I'd like to invite you to Codeforces Round #465 (Div. 2) which takes place on Monday, 19 February 2018 at 19:35 MSK. The round will be rated for division 2 participants. However, as usual division 1 can take part out of competition.

The round is prepared by my friends Kammola, Ahmad_Elsagheer, MostafaAbdullah and me (AhmedSoliman). Besides, many thanks to 300iq, mike_live, Arpa, GreenGrape and FalseMirror for testing the round, KAN for coordinating the round and MikeMirzayanov for the great Codeforces and Polygon platforms.

You will be given 6 problems and 2 hours to solve them. The scoring distribution will be announced later. Good luck!

UPD1: Scoring is 500 — 750 — 1250 — 1750 — 2250 — 2750

UPD2: Congratulations to the winners!

Division 1 :

  1. Benq
  2. eddy1021
  3. KrK
  4. kmjp
  5. chemthan

Division 2 :

  1. Iiu_runda
  2. FlzzyDavid
  3. baggins
  4. sorry_teamskiy
  5. InkyFlameMaster

UPD3: The Editorial is available now!

Thank you everyone!

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

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

a bit late for Chinese users.

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

It is raining contests!!!

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

So many writers/testers/coordinators for a div.2 contest! What I mean is that I do appreciate the effort put on this contest and do not mean anything in a negative way.

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

Once again, the purple problem setter.

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

CODEFORCES is on fire ..!!!

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

Unfortunately, I misread the C problem, I passed 4 problems, but the score is very low, I did not have the chance to have the first time to make 5 problems T.T

It seems that I need more practice.

Look forward to the next contests

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

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

The Announcement is 8 days before the contest. Lets hope the scoring will be announced early like the announcement.

UPD: It wasn't in the main page

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

GUC D:

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

Good luck

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

Codeforces is smashing , it is going wild , i think today or tomorrow there will be something named "contest overflow"...

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

Hope it will be a bit harder than the last one

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

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

Hate geometry :(

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

More like Mathforces today.

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

One more task and this would have been a beautiful regular round with two divisions.

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

Hackless Round!

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

I think there has been some work on making problems more shitty than they were like in problem E

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

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

A lot of problem C gonna hack this contest

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

Note: Sorry for my bad english.

So, at Problem C the ideea is to find the radius of the biggest circle Which has the laptop point and doesn't exceed the flat Area. This is relative simple The radius is (R+sqrt((x1-x1)^2+(y2-y1)^2))/2; But.. How can I Find the center of this Circle? That is the question. :)

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

    Required radius

    The center will be the point at above calculated distance r in the direction of (x1, y1) from (x2, y2).

    Let P1 = (x1, y1), P2 = (x2, y2) and . Then center should be at .

    Handle the P2 outside apartment and P1 = P2 cases separately.

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

    Find distance from laptop to center of the given circle. That plus the radius will give the diameter of the circle you want. The center of this circle will be at the midpoint of this line, which you can find with a bit of trig or by using ratios

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

    you can use some maths let center of flat to be (0, 0)

    phi = atan2(y2, x2)

    x3 = -R * cos phi y3 = -R * sin phi

    (x2, y2) — (x3, y3) is diameter of circle you need.

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

how to solve c?

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

Someone can explain how to do the C problem? How can I maximize the area of the circle? My only thoughts was achieving this by some binary search...

My general ideas all surrounded something like that: if Fafa's laptop is outside or at some flat's end, then the answer is all flat's area. If not, then choose the center whose maximize the area. This is the right way to do?

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

Fifa and Fafa? Really? What about Fofa? And Fafi? And...

Joke aside, it's usually better to have easy to differ names (e.g. Alice and Bob). Otherwise it can be really hard to follow the problem statement while remembering who is who.

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

Does anyone know what test 6 D would look like?

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

Hi, how to solve E?

I have a solution if there has no constraint of P & M, that is: Greedily choose '+', but if expression satisfies |E1 — E2| > |E1 + E2| and it's not leftmost expression, choose '-', such that the answer is optimal.

But I have no idea about with constraint of P & M.

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

can someone tell me why my approach for d is wrong https://ide.geeksforgeeks.org/TGNpoGcVTH

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

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

I think the problems are sorted by how shitty they are but then I think about problem C and how awful it was to implement.

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

    C wasn't particularly hard to implement for a geometry problem. There was only one extra case to take into consideration: (x1, y1) = (x2, y2). Other than that, the implementation was relatively clean.

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

      The whole idea of geometry problems are shitty and awful

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

      Apparently, Fafa's laptop can be outside the Flat too. Test case 3 shows this. This is another case I guess. Personally I felt the problem had incomplete information/ is misleading. Why say that Fifa and Fafa share a flat together when Fafa's laptop can be outside the flat?

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

        The problem specifically states The flat is centered at (x1, y1) and has radius R and Fafa's laptop is located at (x2, y2), not necessarily inside the flat. Plus, there is that test case. There was absolutely no ambiguity.

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

          I understood that. All I was saying is it was said Fafa and Fifa share a flat in the problem. Many people misunderstood this as Fafa always stays inside the room.

          UPD : It is mentioned in problem that Fafa's laptop is not necessarily inside the flat. I guess I missed it.

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

I think some drawing would have made C easier to understand :\

Anyway, nice problem and problemset also, thanks :D

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

Spent half of my time minimizing the 'uncovered area' which not at all required. And like kirjuri said, assumed Fifa and Fafa as Fifa. Problems were good but statements could have been made better.

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

Wow, I'm impressed. The problems included some interesting Egyptian background, which I enjoyed. The last problem was tricky for me, and I spent much time thinking, fixing the code and analysing special cases. Personally, I had a great time. Thank you very much!

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

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

Can someone please tell me what's wrong with this solution to D : link?

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

Finding centre of the circle after finding the required radius can be done by the sector for external divison in problem C(handling corner cases differently)

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

For problem D:

P is number of valid changes, Q is the number of all changes. The result is P/Q mod MOD ...

How to calculate P/Q mod MOD ? I thought about modular multiplicative inverse but I couldn't implement it...

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

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

Can someone say if this method for problem E would work?

lets say we process expressions in decreasing order of nesting.Dp[i][2] denotes the maximum and minimum value of that expression.So now we can make transition easily to lower nesting .

Sorry if this question is too naive.

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

Problem C using ratio and proportions

Question

UPDATE (It is Correct)

There is nothing wrong with this solution. It is actually correct. As people below pointed out I didn't check for integer overflow and printed wrong variables. After I fixed that I got AC

SOLUTION : http://mirror.codeforces.com/contest/935/submission/35502661

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

Классный раунд, спасибо авторам!

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

Can someone please point out what is wrong with my code for C? http://mirror.codeforces.com/contest/935/submission/35496680

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

Solved the first two problems as fast as I could.Then saw FIFA my eyes lit up :) but it took forever to actually get it AC.

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

The radius is the same as in the correct answer, why is it WA?

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

Could someone explain how to do D?

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

Sadly my incorrect F passed systests. I incorrectly thought that the minimum difference would just subtract -1*diff instead of -2*diff during the contest and when the ranges are small I just passed through the whole range to get the best answer.

30

1000 990 980 970 960 950 940 930 920 910 900 890 880 870 869 870 880 890 900 910 920 930 940 950 960 970 980 990 1000 1010

1 1 2 29 1000

This case breaks my solution (it prints 2269 instead of 2268, it should choose the 869). http://mirror.codeforces.com/contest/935/submission/35492061 this is the wrong submission. This is a small mistake from me that usually wouldn't happen to anyone but I hope that the tests didn't impact any rating (the implication of this is that there's no big query where it's better to get an i where a[i — 1] > a[i] and a[i + 1] > a[i]).

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

Can some one please tell me what is wrong with my solution the radius i am getting in the test case 14 is correct but the checker comment reads "wrong answer Too large radius." link

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

I got confused by Fifa Fafa Fafa Fifa Fafa Fifa Fifa Fafa

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

Can you please suggest what is wrong with this solution for problem D: https://ide.geeksforgeeks.org/el12hkWIU0 ?

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

Hi, I submited a code (35493900) in the contest for problem c and it gave Idleness limit exceeded!!! but after the contest I submited the same code (35503114) and it was accepted!!! I was wondering if you could fix this problem and fix my score !!!!!!!!!!!

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

I got the message below after competing in this round. I did not cheat or attempt to cheat during the contest. Furthermore, I worked locally on my own computer. Could you please take a look at this issue? The odds of submitting a very similar code for a div 2 A problem are rather high. Thanks!

Attention!

Your solution 35483271 for the problem 935A significantly coincides with solutions HSNBRG/35477249, wertzu/35483271. 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.

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

Random observation regarding test data in problem F:

solution which says "OK, in case there is local maximum — let's pick it, otherwise let's check all possible moves in O(N) per query" passes easily without any additional tricks or optimizations. 35497796 is an example (obfuscated though, since it was originally an attempt to code correct solution).

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

awesome C :)

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

I think I can get up,but...

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

A bit late for coach Marcil!

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

F problem. I think we should add such data.

5

2 3 1 1 1

5

2 5 5 2

2 3 4 3

1 4 4 1

1 3 5 2

1 1 1 1

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

Can someone please tell me what's wrong with the following approach for problem D? :

For each i, I find the number of ways that all the letters upto i - 1 are the same, and a[i] > b[i].

Then, the number of ways for each index is p = x * pow(m, unknown[i + 1]) where x is the number of possibilities of a[i] > b[i], with different possible conditions, and unknown[i + 1] is the count of erased numbers in either a or b, from i + 1, to the end.

Also, I multiply to p, pow(m, bothZeroes), where bothZeroes is the number of indices up to i - 1, at which a[i] = b[i] = 0, because any 1 of the m numbers could be chosen for such indices.

But, I looked into this code, and he hasn't multiplied the pow(m, bothZeroes) part to his answer. What's wrong with my approach, and how come the m^bothZeroes part isn't required?

Link to solution.

Will be glad if someone could help. Thanks in advance.

Edit : p is not the probability, it's the numerator part.

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

why fifa and fafa ???? can't you use good names ??? i got confused while reading the statement , fifa.. fafa.... fafa... fifa.... what the hell