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

Автор Snezhok, 9 лет назад, По-русски

Всем привет!

Поздравляю площадку Codeforces с Юбилейным 450-ым раундом!

Мы рады сообщить, что 11 декабря в 19:05 MSK состоится рейтинговый Codeforces Round #450 для участников из второго дивизиона. Традиционно, приглашаем принять участие в раунде участников первого дивизиона вне конкурса. Надеюсь более сильные участники также найдут для себя интересные задачи:)

Задачи подготовили я и Никита slelaron Костливцев. Хочется выразить благодарность координатору раунда Николаю KAN Калинину за помощь в подготовке контеста, mike_live, Arpa и Livace за тестирование задач и, конечно, Михаилу MikeMirzayanov Мирзаянову за отличные платформы Codeforces и Polygon.

На раунде, как обычно, будет пять задач и два часа на их решение.

Разбалловка стандартная: 500 — 1000 — 1500 — 2000 — 2500.

Желаю всем получить удовольствие от контеста, высокого рейтинга и удачи!

UPD: Соревнование завершилось! Надеюсь раунд вам понравился:)

UPD: Разбор. Задача Е будет скоро добавлена.

UPD: Задача Е добавлена.

Поздравляем победителей!!!

Div 1

  1. KrK

  2. zscc

  3. wwwwodddd

  4. uwi

  5. oversolver

  6. Shayan

  7. dreamoon_love_AA

  8. please_delete_account

  9. alexrcoleman

  10. guille

Div 2

  1. zeronumber

  2. Brightness

  3. UBICA

  4. Lyon_71

  5. mmkh

  6. I_Love_Adriana_Chechik

  7. Ant_Man

  8. yuvalsalant

  9. Natsume_Mio

  10. PuriceLoh420

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

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

Jubilee for codeforces, the first for me)

Good luck :D

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

5 div2 contests and 1 div1 in 9 days? already best december gift

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

is it semi-rated ?

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

he did not say "the scoring will be announced shortly before the start of the contest." This is a miracle xD

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

Five contest in ten day

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

Typical Div 1 users: "I will just create a new account participate with it. So I can ruin other Div2 users."

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

5 contests in 9 days Indians be like:

![ ](Image and video hosting by TinyPic)

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

Been looking at red username for so long I thought Anniversary was a person

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

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

Wish all the participants high rating! )

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

Deleted

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

Hope you make progress and show yourselves!

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

Кто дизлайкнет — тот Панин.

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

For God's shake resolve servers' issues before the contest!

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

3 rated contests in a week, week of the FINAL EXAMS for God's sake...

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

It's to late for Chinese coders. I can only participate the next one. 555

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

Why the frequency of div1 contests so low? We want more div1 contests.

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

5 Contests in Week And I have Exams :(

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

5 Contests in Week , And I Have Exams :(

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

May God bless the servers !

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

KAN+Anniversary=Kanniversary

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

Just In case what we all expect happens =)

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

Hello darkness my old friend..

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

I dedicate my success in today's round to my two senpais: FLEA and miro! Btw I hope miro didn't cheat today!

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

What the... video

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

There is one thing i have to say: You guys have made the BEST round ever! Your statements are the BEST!

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

OMG D is so easy!! I wish I didn't waste my time attempting to hack. :(

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

What is test 3 in C?

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

Hint for D?

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

write brute force find sequence google it find sequence on OEIS with formulae == DIV2 D

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

Is the answer to question D-Unusual Sequences simply 2^(floor(y/x)-1)-1??

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

Really cool problemset. Hope more like it are coming!

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

How to do D? Got it down to finding all sequences of numbers that sum to y/x with gcd 1.

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

What is the idea behind B & C ? :(

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

The problems and the statements were excellent. Although to me E seemed a bit easier than usual.

Good job :)

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

You can find D here https://oeis.org/A000740 Is it okay?

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

Can anyone explain how to solve problem C?

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

    sorry my poor englishh, you can compute current records, if i'th element less than only one element on previous all elements, you can push vector <pair<int, int>> these elements, first is p[i], second is only one element that (p[i] < p[j] && j < i) p[j], if i'th element equal this vector's second element current_ans + number of vector's elements (v[i].second == p[i]) then, if i'th element also record element current_ans — 1, you can finish this problem.

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

    A somewhat different(maybe) approach:

    For each element find number of elements less than it and before it in the permutation. Get all elements such that there is exactly one element before it that violates the condition of this element being a record. Say we store them in c Now for each element find all elements greater than it c. Observe that we can get number of records in O(1) for each element being dropped.

    Note: All of the above computation can be easily done by a merge sort tree

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

thanks for very short conditions))

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

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

This was the best codeforces contest so far.

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

In my opinion problem B,C,D,E were from almost same difficulty level. So the order one attempts the problems matters a lot in the standings. This is certainly not good for the contest.

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

Problem E can be solved with FFT?

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

    yes with fft we can find from what all positions there is a possibility of t being there. the idea is for finding at pos i we need ((s[i+j]-t[j])^2)*(s[i+j]) summation over j from 0 to m-1 to be equal to zero assuming value for character '?' to be zero and rest some positive value. This we can find for all i using convolutions(which can be solved by fft).

    NOTE: We are not using any special knowledge about t here.

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

    Yes, the idea was finding the number of wildcard matching in strings, which can easily be solved using FFT. I was trying the same, fell short of time. After this was a simple DP solution.

    For fft, technique try to find the following sum, . The places, it is 0 are the places where the string T can match string S, from position i. Expand the expression, which is simply prefix sums and one convulution using FFT. Using FFT in this problem, we can do it for general strings as DP is independent of it.

    This is actually what is explained in above comments too.

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

    http://codeforces.me/blog/entry/49613?#comment-335977 this can be used to solve it for any pattern (not limited to "ababababa...")

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

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

In problem D, I forgot that the answer is 1 but no 0 when x=y...sad story:(

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

system testing too slow :(

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

How many iterations do we need to prove our "-1" answer in B? I did 1e5, it passed final testing, but I saw div. 1 users did more, just for precautions?

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

Nice problems! Thanks!

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

nice problems, can't wait the editorial. short statements <3 ++respect

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

Update: I'm sorry for such a comment. I understood.

LOL problem setter,poor test case on problem "B"-div-2.

if input is 22 4 5

answer should be 1.

but I have found -1 from many accpeted code.

How how how????????????

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

tests of problem C were weak some incorrect solutions passed system tests. For example simple test 2 2 1

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

How to solve C?

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

    You basically keep current maximum and second maximum on the array as you iterate. Removing maximum element will add record if(a[i] > maximum2 && a[i] < maximum). The rest is easy from here.

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

      Could you please clarify a bit more. I had thought something like this during the contest but my doubt is this.

      Suppose we have 1 2 5 4 3 Now when a[i]=4 we have a[i]<maximum and a[i]>maximum2 so removing this should add a record. Well it does make 4 a record but how is the number of records maximized? In 1 2 5 4 3 we have two records 2,5 and in 1 2 4 3 we still have 2 records. So the number isn't really maximised is it? And since the question says that we need print the smallest number which maximises the total (which we cant in this question) shouldn't we print 3 as its the smallest but the number of records are still 2?

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

        In my opinion, I think it should print 3……emmm...what is Judy's answer?

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

        Thats why I said in my comment, you have cnt array which tells change, and you set cnt[i] to -1 if i is initialy record (not index i, but value i of course). So here you would have cnt[5] = -1. Later , cnt[5] gets increased only once, because only 4 will become record, so cnt[5] =0. Since cnt[1] = 0, solution will be 1, not 3 or 5 as you said. So we dont look who makes most new records, we only look for change in records. Thats why answer will not be 5, but 1, since cnt[1] = 0 ( it is 0 because 1 is not initial record, we only set cnt[i] to -1 if it is initial record). Hope this helped.

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

    I implemented a solution which is n log n

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

i became purple for the 8th time

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

9 9 5 8 6 3 2 4 1 7

for the given case how the answer be 9?

here if we remove 1 then the permutation will be 9 5 8 6 3 2 4 7 and we get the maximum record which is 3 (2, 4, 7) isn't it?. then shouldn't the answer 1?

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

For problem C, the pretest 3 is:

5

4 3 5 1 2

Accepted output is: 1

My program gave output: 3

I didn't understand why the output is 1. Probably I have misunderstood the problem.

For this input, I thought that if 3 removed then there would be 2 records: 4 and 5 ( because after removal of 3 the sequence would be- 4 5 1 2, the increasing sequence is 4 5 and then 1 is less than 5,so sequence breaks here)

But if 1 would be removed then there would be only one record: 4 ( because 3 is greater than 4, so the increasing sequence would break here)

Where I had misunderstood? Thanks in advance.

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

Hi!

In problem D, I found a correct solution that should be TLE.

If I run the code in this accepted submission: http://codeforces.me/contest/900/submission/33138278 , against case "1 999999527", it lasts like 15 seconds.

It really surprised me that it got Accepted.

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

Why the answer is 1 in prob. C,why not 4? 5 4 3 5 1 2

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

    Something is wrong with the input. The numbers are permutation of the first n numbers.

    Also in the question it was mentioned that we need to print the smallest of all the elements which when removing gives us the maximum number of records

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

      The input is

      5
      4 3 5 1 2
      

      The Prob.C says that "a1, a2, ..., ak the element ai is a record if for every integer j (1 ≤ j < i) the following holds: aj < ai." And if I delete number 1 , then it is "4 3 5 2", only a1...a1 is ok But if I delete number 4 , then it is "3 5 1 2",the a1...a2 is ok? If I misunderstand the meaning , please tell me ,thank you

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

        The way i've interpreted the problem, which I'm not entirely sure is correct is something like this.

        When we have 4 3 5 1 2 there is only 1 record 5 as for only this i we have a[j]<a[i] for all 1<=j<i.

        If we remove 4 then we'll have 3 5 1 2 now too the number of records will be one because 5 is the only record. In fact if we remove any number other than 5 then the number of records would be one. As we need to remove the smallest number for which the number of records are maximised (which is one in this case) we remove 1.

        I'm not entirely sure but this is what I think the question means. Although I've got a doubt against this too. Over here. Maybe you can help if you understand my doubt? Cause I myself am not sure if i've correctly understood the question.

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

      Oh, I see ,does it mean that the a1...ak don't have to be consecutive? For example , as "4 3 5 2" I can choose a1,a3 to be a record?

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

What category of question does problem E, fall into? Can someone suggest similar problems.

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

Wow..That's my first time solved all problems in div2,Thanks for writers!

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

How to solve problem C?

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

Уже в который раз я не получаю AC из-за своих "выдуманных" ограничений...  Стоило сменить на чуть больше — AC