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

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

Всем привет!

Сейчас проходит зимняя смена ЛКШ (Летней Компьютерной Школы), и мы в составе параллели А*+ с ее преподавателями подготовили полноценный Codeforces Round.

Раунд состоится в 05.01.2020 17:05 (Московское время) и продлится 2 часа. В каждом дивизионе будет предложено по 6 задач.

Задачи раунда были придуманы и подготовлены ismagilov.code, devid, Volkov_Ivan, Jatana, karasek, polinarria, cookiedoth, AlesyaIvanova, KhB, AliceG, D.Pavlenko, VFeafanov, LordVoIdebug, forestryks, Ilistratov, seiko.iwasawa, ibraevdmitriy, Drozd_off под руководством преподавателей PavelKunyavskiy, VArtem, meshanya, budalnik.

Спасибо aneesh2312 MarcosK Stepavly Infinity25 tourist antontrygubO_o isaf27 dyrbulshchyl, Kurpilyansky, vintage_Vlad_Makeev за тестирование!

И, конечно же, спасибо MikeMirzayanov за великолепные системы Codeforces и Polygon, и 300iq за координацию раунда.

Всем удачи!

UPD: В задаче E была допущена ошибка в авторском решении, а именно переполнение типа long long при подсчете ответа. До первого теста, на котором оно случалось, дошли 4 участника (ainta aid Um_nik ecnerwala), из которых 2 прошли претесты, а не должны были, и еще 2 не прошли претесты, хотя были должны. В автоматическом режиме протестировать так, чтобы оба ответа принимались не представляется возможным, т.к. переполнение меняет тесты из-за способа шифрования запросов. Поэтому, мы решили, протестировать два решения прошедших до перетестирования решения на старом наборе тестов, а остальные — на новом. В результате, три из решений прошли тесты, с чем мы подзравляем авторов, а одно получило WA80 на 17-ом ответе внутри теста, что явно не связано с проблемами с переполнением. В дорешивание можно сдать только решение, которое учитывает проблему с переполнением.

UPD: Разбор!

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

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

OMG, round by cyans only!!! _overrated_, where are you looking???

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

cyan round!

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

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

I have changed my color to cyan in order to participate in this round.

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

Round by cyans and for cyans only.

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

why everyone is specialist?

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

Будет ли новый Гончар Фёдор? LordVoldebug LordVoIdebug LordVoIdebug ответьте.

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

why everyone is specialist?

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

pls show me one person that will want to participate in a round prepared by 15+ cyan shkolniki

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

How on earth is MikeMirzayanov cyan.

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

CyanForces!

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

[deleted]

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

What happened to the time being displayed in the local time zone in the blogs?

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

Do I need to be cyan in order to take part in this round ?

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

I thought my laptop was glitching at first.

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

Oh yeah i will definitely participate as there is Ibraev Dimon.(А вы просто указали всю параллель А0 + А?))

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

You guys made me cyan

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

Cyan apocalypse

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

их боялись даже 4еченцы.

самая опасная опг и отмороженная группировка за всю историю человечества.

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

After two consecutive mathforces I hope this contest will not be a mathforces.

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

Btw

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

Mike is the real Loki.

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

Jokes on you I became cyan today. ( for a second I thought I broke the system)

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

I wonder where is UnstoppableChillMachine...

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

Is this some kind of anti-ratist movement?

let's remove colors! make them all cyan!

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

Is this some kind of anti-ratist movement?

let's remove colors! make them all cyan!

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

Yesterday we participate contest with maximum no of registration and today we are going to participate contest with maximum no of writer.

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

Round doesn't seem worth participating in. Maybe with 900 more of these problem setters it will equal the quality of an Um_nik round.

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

Joining the cyan trend!

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

the winter SIS (Summer Informatics School)

Hold up.

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

Specialist round!

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

.

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

Why is it cyan round?

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

The round is rated for every one with ratings between 1400 and 1600. However, all of you who wish to take part and have not rating between 1400 and 1600 , can register for the round unofficially.

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

Is it just me, or it's actually looks satisfying to see all cyan like that

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

cyanity

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

Me: (Looks at setters) This is incyanity

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

A creative use of cf new-year magic!

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

Even if we consider the worst-case scenario, where both divisions have completely different problemsets (i.e., 12 unique questions in total), it is still way less than the number of writers for this round (which is 22). Interesting.

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

    Every problem has been worked on by multiple people. You can easily have one person write both (english and russian) statements and 1-2 others do everything else all at the same time. Yes, every person listed as a writer is actually one, everyone had a part in making the round.

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

Go team Cyan!

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

Over 20 writers for 8-9 problems (combined in Div 1,2)... Can we expect each problem to be a mixture of multiple concepts and observations ? And will not be speedforces today ?

P.S. It should be fun today. :)

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

The round of 1000 cyan .. = the round of Um_nik

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

Hell yeah, cyan round.

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

in respect of all the cyans

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

in respect of all the cyans

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

Let's make cyan great again everyone!

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

the number of authors makes me feel good about this round, but I hope it's not a mathforces

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

When you're not cyan yet:

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

Does it mean that EvenImage would be participating today.

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

Cyan round?

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

I can be cyan after this cyan round!

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

One more cyan! UPD: scores for problems?

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

How is task complexity calculated?

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

Seeing a strong cyan community, Hoping to become a Cyan today.

Good Luck everyone!

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

Why there are some candidate masters registered in div2 and some experts registered in div1?

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

My rating is 1346, would this div 2 contest be rated for me? I am confused as it is not mentioned in above blog.

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

Is it Rated?

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

This is the point where you need to cut down the list of authors on the Contests page to only the most relevant ones because it's tl;dr.

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

    What do you mean by "most relevant ones"? Everyone had a part in making the contest.

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

      What do you mean by "most relevant ones"?

      Are you asking what the phrase "most relevant ones" means or who should be considered the most relevant ones? In the first case, try a dictionary, in the second case, I can tell you what I'd pick if you describe the preparation process in detail and how everyone contributed.

      If, for example, I made a dumb heuristic solution for some problem and a countertest for that got added, I wouldn't consider it relevant enough to call myself one of the authors of the contest.

      Everyone had a part in making the contest.

      And everyone can be mentioned for example on this page, with a shorter list posted where it would be an inconvenience to have a very long list — the Contests page, in this case. It's not like everyone who had a part in making a contest should make their own blog post about their part in it, either, right? The logic is the same.

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

        So every person got assigned to a problem, with 2-3 people per problem, and each team then distributed the tasks between its members. There's really a lot to do if you're making a problem in polygon: write a statement and a tutorial in 2 languages, write several solutions (correct and incorrect ones alike), generate tests, make a checker and a validator, and each one of these tasks can pretty much be done independent of others. Of course, the harder the problem, the harder each of these tasks are, but not significantly: everyone involved knows the statements and the solutions well, so preparing any problem is pretty much a routine job. So there really are no "most relevant" problemsetters, they are all roughly on the same level.

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

          Huh, that's... unusual. Most of the time, there's someone who makes sure statements are ok, someone (possibly the same person) who makes sure translations are ok, testers who write the correct+incorrect solutions and comment on what's missing, and for each problem one, very rarely two people who do the main, initial brunt of the work — basic statement, correct solution, basic tests.

          each one of these tasks can pretty much be done independent of others

          I don't have that experience. When I'm preparing a problem, in order to make strong tests, I want to understand intricacies of the problem and the solution well enough that I might as well write it down, so making the statement, tutorial, one solution and tests is all interconnected. The same goes for the checker if a non-trivial one is required. If I do just part of it, I can miss something important, and if I divide it up with someone else, it happens too often that one of us ends up doing too much or there's just a general lack of communication, and it costs more than it offers. Then, some tasks are independent — validator, simple checker, simple bruteforce etc, and some, like good translations, then require specialised roles.

          In your case, it's more like when there's a prioritisation meeting at work where some bigger structured task was already explained and divided into also explained smaller parts before, it gets moved from the todo list and team members are assigned to parts of that task. Since you mentioned that each assigned person knows their problem+solution well enough.

          Anyway, regarding the long list: you mention 18 people + 4 teachers/coaches + some testers. Since you mention 2-3 people per problem, I assume that's the 18. If each person is mentioned just for 1 problem and only for the division where that problem appears (C is one problem), that would cut it down. Another, probably better alternative, would be to just keep the list of authors on the Contests page empty. Whoever wants to read it can read it here.

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

What is scoring distribution!!

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

Let's all convert to Specialist

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

Come in as a fake cyan, come out as a real cyan.

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

i didnt registered because i didnt see starting time how can i now register there is 50 minutes remaininig?

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

me at the contest cyan round was very difficult for me

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

good contest. specialist here i come!

stuck TLE on div2B for about 1h until i found i used map changed to unordered_map and pp lol

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

Nice Impossibleforces !!

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

Is this correct for D2E1/D1C1 —

We ask (1,1) + (1,n) + (2,n) By (1,1) we get first character, by (1,n) and (2,n) we can get only prefix substrings. By keeping count of frequencies, we can place characters by reducing the first character one by one.

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

On problem C, I spent 20 minutes debugging my code, only to find out that all I was missing was the edge case where N = 1. :(

Overall, great contest in the D2 at least.

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

https://mirror.codeforces.com/contest/1287/submission/68274741

Please explain why this isn't working. Time complexity is O(n*n*(k+log(n))) Can it be done in better???

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

How to solve C?

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

never mind

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

Why constraints for DIV2 C are so low? It can be solved in O(nlogn) using greedy.

Update: my solution passed system tests

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

That feel when you read that test 20 is incorrect and then get "Pretests passed".

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

How to solve B?

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

    lets choose two strings i , j any two are valid ( try to prove it ) then you can know the third string in this way loop in those two strings if current two chars are equal then the third string must have the same char else the third string must have a char nethier equal those chars in that position

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

Terrible
I have a problem with live contests usually I can solve div2A in < 15 min and div2B in < 30 min (in training)
But I need to see the test cases to see why I get WA... if someone know how to get over such a problem..
Yes and i will be newbie after this round

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

Do you really think putting these problems together in one round was reasonable choice? Already C2 was a tough one and A+B+C1+D (solving only one out of 4 hardest problems) gives me 11th place before systests.

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

    I prefer contests like these to contests where all the top participants solve everything. It gives freedom to choose which problem to solve. Pretests could be stronger though. :(

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

Why did i go in thinking a cyan round should be like taking candy from a baby :sobs

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

Does this mean I have successfully hacked the judge?

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

Any gueses what is in test 3 for Div2C?

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

Anyone solved C2 by asking $$$(1, n)$$$, $$$(1, \frac{n + 1}{2})$$$ and $$$(\frac{n + 1}{2}, n)$$$?

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

5 4 SETT TEST EEET ESTE STES Participant's output 0 Checker comment wrong answer 1st numbers differ — expected: '2', found: '0'

But my dev c++ runs out 2 Can anybody explain that?=_=

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

Interactive problems...

Find out a solution at last but keeping 'Idleness limit exceeded on pretest 1'

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

How to solve B ?

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

    Choose 2 strings and try to make the third one. You can see that if you have 2 strings, there can be only 1 third substring. All you have to do is to create a map to store the frequence of every string and, after you build the third string, add its frequency to the answer. Be careful, you count every triplet 3 times, so, at the end you should divide then asnwer by 3. :)

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

I got WA on D and E1 on first submission because i was missing the case N = 1... Has it happened to someone else? :)

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

Thanks for including $$$n = 1$$$ in pretests for C1 -_-

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

Really sad. I found where I made a mistake in my prob D code after 2 minutes the contest had over.

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

How to solve Div2-D?

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

    Start placing integers in nodes in decreasing order — When subtree size = c-value, this is max in subtree, select the one with lowest depth and decrease subtree size of all its ancestor by 1.

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

      Can you explain what you mean by "start placing integers in nodes in decreasing order"? Should you place bigger integers before smaller ones? Or should you place integers from nodes n to 1? And what do you mean by "subtree size = c-value"? What is max in subtree of what? And what do you mean by decreasing the subtree size of all its ancestors?

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

Thanks for the nice Div1C? How to solve Div1D

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

How to solve Div1D ?

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

can someone please explain why this solution 68252477 for PROBLEM B of DIV 2 is getting TLE

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

spend half an hour on alternative, correct solution for Div2-C

submit old buggy version with 2 minutes left

Sigh...

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

I liked problem C, but it can be hard to spot the solution. It is kind of guessing which approach to take.

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

C is probably my favourite interactive problem now, finally something that is not binary search :Dd

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

How to solve Div1D ?

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

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

I hate subtasks so much!!!

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

What's wrong with this solution for div2B? I am getting TLE on pretest 10. https://mirror.codeforces.com/contest/1287/submission/68262344

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

is Div2-C solvable with DP ?

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

When you are just on time. epic.png

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

So what's the best ratio anyone's gotten in Div1 C2? My solution takes about $$$0.75N^2$$$ and that's likely the intended one. It doesn't feel like this would be the optimal solution.

Edit:

According to aid a query restores the string uniquely up to reversal, which makes the problem much simpler. I've no clue how one proves that, though.

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

    I think you can solve it with one query for the whole string and then one more question for a single string. The algorithm is rather messy so I didn't get time to implement :(

    Basic idea: Looking at strings of length $$$N-1$$$, you can get the first and the last symbol. Then, with some considerations, from the strings of length $$$N-2$$$ you can extract 2nd and $$$(N-2)$$$-nd symbol, and so on.

    There is one more consideration: the first time you encounter different characters with the above algorithm, you can ask for one of them directly. After that, you can use this difference to figure out where each character is for each different pair in the next iterations.

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

    Look at all strings of length $$$n-1$$$. There are 2 of them. From them you can restore first and last elements, but you don't know which one is first and which one is last. If they are different, ask about the first one. Then if we restored the first and last $$$k$$$ elements, let's look at the strings of length $$$n - k - 1$$$, we know all but 2 of them. Find those 2 strings, from them we can find $$$k+1$$$-st elements. There are some cases like when we already found 2 different characters and not.

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

    My solution uses around $$$\frac{2}{3} N^2$$$:

    C1: $$$\textrm{query}(1, N) - \textrm{query}(2, N)$$$ gives you the set of prefixes of the hidden string, which is enough to construct it. It uses around $$$N^2$$$ strings.

    C2: With the same idea from C1 we can learn the first $$$\frac{2}{3}$$$ of the hidden string using $$$\frac{4}{9}N^2$$$ strings. Knowing the middle third of the hidden string and querying its last $$$\frac{2}{3}$$$ (an additional $$$\frac{2}{9}N^2$$$ strings) is enough to construct the final third.

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

      Can you explain how do we get the last third of the string?

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

        We want to construct a string of length $$$2T$$$. We know its first $$$T$$$ characters and we know the list of responses from querying the entire string.

        From the unique response with length $$$2T$$$ we know the unordered contents of the full string.

        Suppose that we have already figured out the last $$$k$$$ characters of the string. Initially $$$k = 0$$$ and when $$$k = T$$$ we are done. We consider all substrings of length $$$2T - 1 - k$$$. We already know enough characters at the beginning and end of the string to construct all of them which don't start at the very beginning of the string (subtract excluded letters at the beginning and end from the contents of the full string). By elimination we find the one which does start at the beginning: it gives us the $$$(k+1)^\textrm{th}$$$ character from the end.

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

What's with pretests in Div2B not even having the stress cases? It sucks to get TLE on main-tests for some constant optimisation.

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

CAN YOU MAKE PRETESTS STRONGER?

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

Very very very weak pretests :(

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

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

Attempt 1 : TLE
Attempt 2 : TLE
Attempt 3 : TLE
Attempt 4 : TLE
Attempt 5 : Pretests passed at 1:59:32
Reason for TLE : use of set to find the character not present at a given index rather than simple if else.

 set<char>se;
 se.insert('S');
 se.insert('E');
 se.insert('T');
 se.erase(s[i]);
 se.erase(b[i]);
 char a = *(se.begin());
»
6 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

https://mirror.codeforces.com/contest/1287/submission/68275963 this solution give output 0 for n=7,p={0,0,0,7,0,0,0}, but actual output is 1

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

That's not the way on how to write problem B for Div 2.

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

Duh, getting $$$O(3^n)$$$ is not that hard in F, definitely more doable than anything like $$$O(2^n n^{10})$$$ and indeed as I expected both accepted solutions are $$$O(3^n)$$$ -.-

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

never give up :))))

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

unordered or ordered map ? In some problems unordered passes while ordered fails, while in others exact opposite happens.

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

    Always use map,unordered map's time complexity depends on nature of input,if a solution passes for unordered map but fails for map,then it's either bad implementation or bad question

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

    Unordered map is faster, provided that you have a good hash function. The reason why unordered_map is sometimes slower than regular map is that there exist special techniques of generating worst-case tests for unordered map, where standard hash functions give a lot of collisions.

    See this blog for more details.

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

The contest was raely nice but I had a better idea on it
It was realy nice to add a simple problem at the begining of the Div. 2 then you change the n of the problem Div 2. D to 1e5(solveable with easy dfs).
so the contest would be better to solve.
And also D was easier than C and swaping them was a good idea.
Thanks CyanForces!
It was good at all.

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

What is the time complexity of writer's solution of problem F? I think coming up with O(3^N) solution is not so hard, yet I was able to fit it to TL by pruning: 68281697

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

Could someone please, tell me, where I went wrong. 68273158

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

How to solve DIV1B/2D numbers on tree.

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

    I solved in this way: Keep the number of nodes in the subtree for each node(let it S[]). If there exists i such that S[i] <= C[i], then the construction is impossible. Otherwise, the construction is always possible. Keep 1, 2, 3, ... n originally in a set data structure(e.g., treap?); let the the set B. From the root, run DFS and make each A[i] value to C[i]+1th smallest value of B, and erase the value from B. Then, the number of smaller nodes in the siblings are exactly same to C[i].

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

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

Sorry, but it was a coincidence.

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

My solution for C was 100 lines in python (making lists of gaps with different ends then sort etc) there should be some shorter approach to avoid this spaghetti mess.

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

When tutorial will be published???

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

in problem B, TLE code in contest time 68259187. Ac code after contest 68286650.

just modified a simple function named f(). I think it should not matter. please have a look.

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

It was a good contest.

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

Тестиролвали, тестиролвали, да не дотестиролвали

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

Can someone tell me why this code gives WA on div2A?

        #include <bits/stdc++.h>
        using namespace std;
         
        int main(){
         
        	ios::sync_with_stdio(0);
        	cin.tie(0);
        	cout.tie(0);
         
        	int t, n;
        	string s;
        	cin >> t;
        	while(t--){
        		cin >> n >> s;
        		int mx = 0, counter = 0;
        		for(int i = 0; i < n - 1; ++i){
        			if(s[i] == 'A' && s[i + 1] == 'P'){
        				i++;
        				while(i < n && s[i] == 'P'){
        					counter++;
        					i++;
        				}
        				mx = max(mx, counter);
        				counter = 0;
        			}
        		}
        		cout << mx << '\n';
        }
        return 0;
    }
»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

How to solve Div.2 C/Div.1 A?

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

I m newbie can someone tell me where is the editorial?

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

https://mirror.codeforces.com/contest/1287/submission/68290995 wrong answer on case 12 which doesn't have a value at index 0.

https://mirror.codeforces.com/contest/1287/submission/68290894 wrong case on case 8 which also doesn't have a value at index 0.

https://mirror.codeforces.com/contest/1287/submission/68290844 wrong on case 12 which also doesn't have a value at index 0.

https://mirror.codeforces.com/contest/1287/submission/68290780 wrong on case 19 which also doesn't have a value at index 0.

please help me with this error .

My approach

i am not able to manage what should be done first .

My approach

in some cases assigning to first works in others after assigning to all gaps first and last are checked. Only 4 types of gaps are possible: even-even, odd-odd, even-odd, odd-even For even-odd and odd-even, the minimum complexity generated is always equal to 1 (doesn't matter if you use all even or all odd or combination of both) So just take all even-even and odd-odd types of gaps in increasing order of gap value and greedily fill them. E.g. for even-even if enough even numbers are available to fill the whole gap then the minimum complexity generated is 0 otherwise 2. Gaps in start and end of the array are needed to be handled separately.

7

0 3 0 5 1 4 2

The correct answer is 2, not 3 , my code is giving 3.

Please help me fix it.

should i sort the gaps in increasing order of length before filling?

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

Editorial???

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

div1 F

O(3^n) can spend only 300ms

my code

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

can someone tell me why i am getting tle on problem(B. Hyperset) here is my solution https://mirror.codeforces.com/contest/1287/submission/68274322

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

Grammar mistake in the description of div. 1 F.

"The array is considered destroyed is all its elements are zeroes."

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

Waiting for editorial...a bit par contests for green coders...

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

How to solve div1D?

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

    Let $$$dp[i][j][0/1]$$$ = probability of proton $$$1 \dots i$$$ 's first collision time is $$$j$$$ , $$$i$$$-th proton flies to right/left.

    There is at most $$$2n$$$ different values of $$$j$$$.

    Use segment tree to optimize,time complexity is $$$O(nlogn)$$$ .

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

respected sir, i have no clue how my code matches with the other 2 persons you mentioned in the e-mail. this is absolutely a coincidence. i neither share my code with anyone nor do i copy. i used flag method to solve the question which is quite common, and hence may be it matches with these 2 other persons. thank you anirudh agarwal

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

(https://mirror.codeforces.com/contest/1287/submission/68307501)

Please help me i have done everything still this is not working on test 12 but working fine till 18 tests other than 12th one.

Thanks in Advance.

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

In D1C, any solution to query two times, [1,n] and another point, is impossible.

Consider the following 4 strings: abaabbab abbabaab baababba babbaaba

If someone only queries [1,8], he will got exactly the same results.

I'm not sure if it's possible for [1,n] and queries of O(1) additional length.

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

how to solve div 2 C ?

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

Where I can find editorial?

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

Where is the Tutorial???

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

Why is this 68314242 passing and not 68261685 for Div2B?

The only difference is the way in which i find the third string to be searched! Both are constant time!

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

Can someone explain the DP approach for Div2 C, it is not there in the editorial released.

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

there is O(n) solution in question Div2-C by greedy

1-count number of different parity between number which aren't zero

2-sort contiguous segments of zero by counting sort by their length in O(n), we can use from vector structure like vector p[100] which index is our length of segments and we store start and end of segments, we can iterate vector's elements in O(n)

3-chose smallest contiguous segments of zero which don't start from beginning and don't ends at the last element, these segments are between two numbers like x and y (for example x 0 0 0 ... 0 y)

4-if x % 2 != y % 2 then we have one different parity in this segment always so don't do anything

5-if x % 2 == y % 2 then if you have enough numbers with parity of x % 2 then by adding these number in this segment we have no different parity but if you don't have enough numbers then we have two different parity in this segment

6-after visiting of all segments which aren't beginning of numbers and aren't end of numbers, if there is contiguous segment in beginning of numbers or in the end of numbers then our segment is like ... x 0 0 0 0 ... 0 0 or 0 0 0 0 0 ... x ... then if you have enough numbers with parity of x then we don't have any different parity and if you don't have enough numbers with parity of x then we have different parity with 1.