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

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

Hi everyone!

I want to present you the Codeforces Round #361 (Div. 2) that will take place on the 6th of July at 19:35 MSK. The contest was prepared by Gabriel I_Love_Tina Cojocaru and Mihail ThatMathGuy Tarigradschi.

I'd like to thank Dan danilka.pro Sagunov and Gleb GlebsHP Evstropov for their help in preparing the round and for making the round possible,Mike MikeMirzayanov Mirzayanov for the great Codeforces and Polygon platforms.

Good luck in the contest!!

UPD1.In this round you will help our hero Mike solve tasks he encounters every day.

UPD2. Editorial

UPD3.Congratulations to the winners of the round.

Div 1:

1.Um_nik

2.cgy4ever

3.anta

4.HellKitsune

5.ksun48

6.waterfall

7.Kaban-5

8.I_love_Tanya_Romanova

9.I_love_tigersugar

10.RomeoFantastik

Div 2:

1.Sky4teen

2.TudorMiclovan

3.darius.marian

4.Hirasawa_Yui

5.Chloe_fan

6.AnonymousBunny

7.fenchen

8.Grandpa

9.6eJIa9IzZzTeHb

10.raiders7

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

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

Wow ! everyone got a "middle" name :) ;)

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

Yah i'll try to do better than past.

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

Wow really short announcement... I hope problem statements will be the same ;)

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

For all muslims, this time we're gonna participate with our stomachs filled.

Eid Mubarak :D

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

we are eagerly waiting for this :)

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

Eid Mubarak Everyone :)

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

The next day of contest will be Eid Day. Eid Mubarak everyone. Wish you'll have a nice Eid Day.

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

What's better than a round at the beginning of the summer vacation :)

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

I have two questions. Where is Delinur? I haven't seen that handle in announcements for a long time. And who translates problems now?

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

    Sad but true. Delinur left Codeforces. I believe the translations are made by authors if they do not give any credits to other people. Or by someone else, by occasion.

    Some info from Mike, by the way.

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

plz no more down votes:'(

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

no down votes plz! i will never comment again:'(

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

So, After a complete cycle(360 degree), this gonna be the first round in the first quadrant.

Codeforces Round #(360+1) (Div. 2)

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

Hope the problems will be as real as your handle, I_Love_Tina, unlike something as "The family has 100,000 men give presents to each other."

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

Oh no, ThatMathGuy! I am never forget a problem on analytic and algebraic topology of locally Euclidean metrization of infinitely differentiable Riemannian manifolds!!!!

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

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

The time for this contest is too bad for us! Because it's 00:35 in China. What's worse is that I have lessons tomorrow morning,so my mother doesn't allow me to take part in this contest.I think i must take part in the contest secretly.But,if my mother find me doing this,I think my mom will clapperclaw me.How miserable i am ! Bless me not to be found,codeforces!

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

    An addictive competitive programming is one which you cannot stop taking once you have started

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

Contest just before Eid. It'll be interesting! Eid Mubarak everyone.

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

Those who have summer vacation, Happy summer vacation and Eid Mubarak to everyone wish you a happy, prosperous and AC life ;)

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

Good luck Guys

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

Hoping to see some good problems and ratings up. All the best to all.

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

Recently I can't open submission code of old problems(Rounds before about 100), including my own submission. Anyone has any idea about this problem? Thanks.

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

This round and every other round hero. Thanks to mike for the great Codeforces and Polygon platforms

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

Does anybody feel that the A problem is a lot harder than usual ???

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

Is it just me who thinks this round is scary difficult?

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

My dream to become Cyan has been destroyed :(

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

I think this round is too hard. :'(

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

This round has really made me take a I_Love_Tina check. ;_;

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

How to solve B? Dijkstra?

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

Really nice round) Many thanks

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

How did you guys solve D?

I got pretests passed with binary searching, for every index, the segment that has the same min/max, and answering min/max queries in intervals in O(1) with RMQ.

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

    I think it can be done using 2 pointer two... But the implementation might be complex(IDK).

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

    n = 200000 and sequence is fill with same digit

    what time complexity in your solution?

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

    Can you please explain how you used binary search?

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

      Let's count how many intervals are "good" beginning with i:

      It will be some segment [l, r>, i <= l <= r <= n

      The max_a(i, l) is an increasing function, and min_b(i, l) is a decreasing function, so with binary search you can find the first index l where max_a(i, l) >= min_b(i, l), and then with another binary you can find R, so that max_a(i, r) == min_b(i, r) for every i < r <= R

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

      max(x , R ) is increasing with decreasing x. min(x , R ) is decreasing with decreasing x.
      Now find lower and upper points where max(x,R)>min(x,R) and max(y,R)<min(y,R) . add y-x+1 for every R

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

O(N * logN * logN) gives TL on D :( . I was way more stuck on such an easy solution of B!

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

    Same here ! Got fooled into doing dijikstras ! :(

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

    i used RMQ to answer min/maq queries in O(1), that didn't TLE

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

    Yes. I thought that my solution with Segment Tree would pass. But I got TL 7 and rewrited it using sparse table.

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

    My code has also O(n * log2(n)) time complexity. But it gets AC with 1419ms time. I used segment tree with binary search for all i (1 <  = i <  = n). Here is my submission. BTW I recommend RMQ solution with O(nlog(n)) time complexity for this problem (because of the tight time limits).

    PS: The funny thing is that I couldn't solve it at the contest time because I thought both Mike and !Mike can tell the Maximum value. Didn't read the problem statement well. If they can tell the Maximum value what will be the solution then? Anyone have any idea?

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

      If they both compute maximums, they will always output the same number. Just print n*(n+1)/2.

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

      Vhai in your solution how these two line works ?? I mean what is the logic behind this ?? when (p.fs-p.sc>0) lo=mid+1; ans else hi=mid-1; how the direction of binary search is selected ?

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

        If we go to left then maxa will increase or remain same and minb will decrease or remain same. Now there can be 3 type of cases.
        1. maxa = minb
        2. maxa > minb
        3. maxa < minb
        For second case we have to go to the right side because we want maxa to be equal to minb. For third case we have to go to the left. For first case if we want the lower bound then we go to the left. For upper bound we go to the right.

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

Nice round. How to solve C? Many people solved it very fast! I hope many A fail. :P

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

    Binary search for least value of n that satisfies no of ways greater then or equal to m. At the end you need to check if this value is actually equal to given m or not.

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

      what Right limit did u start with ? And how did u calculate it ?

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

        i actually manually checked what value could give answer till 10**15. it was around 10**16.

        EDIT: Screw this, damn i did checked this in a loop but since i coded binary search function first and then checked for this value, i forgot to update to 10**16. So it will fail final tests most likely :(

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

        I just used 8 * 1015 since M is at most 1015.

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

        Long.MAX_VALUE should be a safe bet I think.

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

    binary search to find n

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

I think that problem A has too week pretests. I hacked 5 solution and I will fail the system test(.

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

What was the hacking test cases in div2 A ?

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

hardest round ever!

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

finished coding D less than 1 minute after the contest ended

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

For me round was very interesting and one of the best in last time ! Thanks !

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

Before 30 seconds the end, i submit div2E and got WA Because i print with I64D, not I64d...

my input : 3 1 1 2 2 3 3 4

output : D

I'm really sad...

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

In Div 2 A,

What was wrong in this

if there is a 1,2,3 and 7,9,0 in the string, then YES

otherwise NO.

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

very bad statement

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

This really freaks me out!

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

wrong answer on test case # 4 :):):)

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

    You probably forgot the backwards paths from point i to point i-1. I had the same mistake :)

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

      i forgot this and costed me 3 WA but realised it later and got AC

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

solve 3 and 2 fail maintest...

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

    I thought this would make me rank 2000+, surprisingly rank 800+ by just solving B :)

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

My Problem A fails for n=1.
Careless mistake sucks!

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

Shittiest contest ever !!!

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

the worst round i have ever seen

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

Помогите доказать решение по Д: я перебираю левую границу слева направо(пусть i) и для нее поддерживаю l и r такие, что минимумы и максимумы равны на соответствующих отрезках от i до [l; r]. Почему верно, что l и r не нужно двигать влево никогда? Если что, решение с двумя бин поисками я тоже придумал и понимаю, почему оно работает.

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

    min a[i..l - 1] > max b[i..l - 1] => min a[i + 1..l - x] > max b[i + 1..l - x] потому что min на подотрезке больше min на отрезке

    аналогично для r

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

Can someone explain why I'm missing these two questions B: 18932534 edit : oops didnt read question

then just check c edit: ok i guess my lower bound is incorrect C: 18935173

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

That was the bad contest I have ever seen

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

I think many people run when they saw Div2A.

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

I can't find mistake in my D. Anyone? :) http://codeforces.com/contest/689/submission/18935532

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

    well first and foremost it's O(n log^2 n), which TLEs on systests

    there must be a bug in your binary search, it's easy to get it sometimes wrong by +-1 or < instead of <=, etc.

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

I think that this contest is the worst only for people who solved only A. So you should study programming better. I liked this contest because of problems C and D. So thank you, I_Love_Tina and ThatMathGuy, for the round.

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

    Well, I think all problem was great. but some description was too hard to understand.

    Really thanks for problem setter.

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

A and B didn't pass, I lost an hour for them... But C and D are easy

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

Sky4Teen???? A fake Account + Shitty Naming Sense!!! :/

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

What is wrong in my soltion of Div2B: My solution

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

Made a typo in A (used brute force and forgot that there are 4 rows and not 3) and failed A on systests. :D

But I still solved B and C so I have this going for me which is nice. By "this" I mean remaining in Div.2 for eternity of course.

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

Решение C, отправленное после дорешивания, не проходит таймлимит: http://codeforces.com/contest/689/submission/18935878 Если запустить локально на том же тесте

PASS

INPUT:
999999999999999

ETALON:
-1

OUTPUT:
-1

TIME:
0.201 s

Почему 0.2 секунды могло превратиться на сервере в 2 секунды?

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

    у тебя все равно упадет решение, правая граница должна быть больше 10^15

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

    Сейчас протестировал в запуске — получилось чуть больше четырёх секунд. Так что всё верно.

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

Rating changes, come on :D

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

One of the best rounds I have done, was freaked out initially after seeing Div2 A though!

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

Good problems, thanks authors!

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

Hardest round ever.

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

Can anyone help me explain this 18922000 solution? And how to develop ideas like this?

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

I thought the contest was rated

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

people saying EID mubarak are getting too much downvotes.Guys they are people like us and celebrate festivals like us .If somebody would have said happy christmas he would have recieved like 1000 upvotes. seriously didnt expect the coding community to be so immature.

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

    No, if 10 people had already said "Happy Christmas!" and more people still leave comments saying just that, then they would definitely not get 1000 upvotes, they would be downvoted. Eid Mubarak is no different. It's just repetitive and adds nothing to the conversation.

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

    they mostly have only upvotes o_o

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

Nice round (although A was more difficult than expected) after being away for a while. Fast system testing and rating changes. Finally pretests weren't weak.

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

    Pretests for A were REALLY weak. So many solutions were hacked :)

    I agree that it was a nice round

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

      Yes, for A I may be wrong, but not for C and D. Problem A doesn't have some non-obvious cases if you implement it straightforward.

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

        n = 1 was a non-obvious case for A :P

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

          No? It was an easy case not being different from the others.

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

            Easy test case — Yes
            Not different from others — No
            wa-submission
            ac-submission

            PS — both submissions were after the contest

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

              OK, I partially agree. It depends on the implementation (for example in my code there wasn't needed to be checked for that case: 18922236). But it's a good advice to always check your solution with a test with the minimum constraints and a test with the maximum constraints.

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

              For my code it wasn't a special case

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

Guys, let me teach you how to write 1000000000 properly. It is (int)1e9 (works with (long long)1e18 too). I was tired counting zeroes while hacking.

And thanks for the round, problems were good (maybe, A was hard for A and E was easy for E).

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

    Since the font size are same, you can tear a piece of paper to make a ruler, or take screenshot and compare the length of them in software like mspaint.

    Task A is probably too complicated for Div2-A, but it is a nice task for Div1 player (many ways to fail it). :P

    • »
      »
      »
      8 лет назад, # ^ |
        Проголосовать: нравится +5 Проголосовать: не нравится
      1. my variant is shorter
      2. there is no way to press '0' 10 times instead of 9
»
8 лет назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

For problem D I submitted a O(nlog^2n) solution and got TLE. I resubmitted the exact same code and got AC with 1716 ms. Is the Codeforces grader usually this inconsistent?

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

Small Doubt:

In problem A, for testcase:

4
1468

One solution can be 4790. Please correct me if this is wrong. Thanks in advance.18957061

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

Please fix the link to the editorial in the contest page, since it links to this post and not to the actual tutorial. Thanks for reading.