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

Автор Wild_Hamster, история, 10 лет назад, По-русски

Приветствую сообщество Codeforces.

1 июня 2016 года в 19:35 MSK состоится очередной раунд Codeforces #355 для участников из второго дивизиона. Традиционно, участники из первого дивизиона могут участвовать в соревновании вне конкурса.

Это мой третий раунд. Надеюсь, он вам понравится.

Большое спасибо Глебу Евстропову (GlebsHP) за помощь в подготовке задач и Михаилу Мирзаянову (MikeMirzayanov) за замечательные системы Codeforces и Polygon.

Участникам будет предложено пять задач и два часа на их решение.

UPD Разбалловка: 500-1000-1500-2250-2250

UPD Разбор здесь

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

Div. 2

  1. fake_fake

  2. __Wind

  3. Mamedov

  4. dianaasau

  5. Sorry_Daikon

Div. 1

  1. Um_nik

  2. TimonKnigge

  3. vintage_Vlad_Makeev

  4. anta

  5. kmjp

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

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

nice and short announcement I think one of the problems is about shortest statement :D Have a nice contest ;) Good Luck For All

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

Пора уже Div1 давать.

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

Good luck everyone! I hope that I'll jump to Div.1 tomorrow and never return back to blue again...

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

is it rated?

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

Vanya is in the house

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

Yes, the round is rated :p
This is answer is for those who are gonna ask "Is this rated?"

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

I am trying to solve problem from your past rounds, but when submit ( 18173020 ) it say Denial of judgement

Is the package for this problem crashed?! what is the problem in my submission?!

UPD the problem fixed.

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

How come Wild_Hamster's profile says his last visit was 5 days ago when he posted this 11 hours ago?

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

A Codeforces Round in it's usual Time now that's new :D

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

This contest is going to begin at 00:35 in china.It is too late, and staying up late is not good for my skin.but I really want to be a blue xiaoai.

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

Nice & short announcement . And Hope to have some nice, short & easy to understand problem statement . And all the best to every participants for today's contest .

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

Let div1 round too. Otherwise, too many fakes will div1 by the participants.

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

Too bad it clashes with another Yury_Bandarchuk's div2 oriented contest on hackerearth (everybody knows it is held on the 1st of every month).

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

    Not everybody. I didn't know. And I tried to schedule contest in such time, that it doesn't clash with another contests:

    May 28 — Codechef&gcj

    May 29 — RCC&gcj

    May 30 — SRM 691

    May 31 — csacademy beta round #6

    June 2 — Hourrank.

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

Hope this round will be my first 4/5. God bless me ^_^

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

Your previous rounds had all math problems. I hope this time there will be more balance :D

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

The email I got said that this was going to be 6 problems in 2.5 hours. Is it 5 problems in 2 hours or 6 problems in 2.5 hours?

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

Lots of math problems are coming I guess :)

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

Wild_Hamster interesting profile picture :D

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

Any update about score distribution? Or is it standard?

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

what about score distribution ?

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

Links to hack submissions do not open in >ten minutes.

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

Omg, I'm so stuck on C. Thanks god it is not rated round for me.

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

Thanks very much for the great round! In my opinion, the only criticism is that the difficulty gap between C and D was too large.

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

How to solve D? Obvious DP gives TL 19.

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

Are 99% of hacks on Div2B are of integer overflow?

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

Waiting for my D to fail...

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

How to solve D faster then O(p*(mn)^2)?

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

I think I missed D by seconds!

I hope my solution doesn't pass. I was taking the limits small.

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

So uh, how to solve D? I was trying to think of DP but couldn't.

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

    IMO , for a point you need not check every Other point with value 1 greater. Check all the rows and columns that form a border across it!

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

    DP + Square Root decomposition

    In the optimal path, once you have collected the first k keys, you should move to a square to collect the k + 1th key. Thus we can divide the entire matrix into layers where ith layer consists of the co-ordinates of the matrix where such that a[x][y] = i.

    Maintain a value for each of these points -> the minimum distance traveled to reach it.

    Now we need to do transition from layer i to layer i+1. A brute force implementation for transition could take O((nm)2) time. Thus we take two cases -> If the size of the previous layer is greater than (nm)0.5 and otherwise. If it is smaller than (nm)0.5 we can do bruteforce, else we do a BFS with careful book keeping. Overall complexity O((nm)1.5)

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

      Hi, sorry if this is a stupid question, but what exactly are we doing in the BFS. I mean if we're doing BFS to find cells of the next layer wouldn't it still be wouldn't the BFS still be O(nm)? I read the editorial and it uses the same approach but I don't understand it.

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

        A BFS from layer i to layer j will take O(nm), but you only do it if layer i is large (larger than sqrt(nm)). Since the total number of chests is nm, you can have at most sqrt(nm) layers with size sqrt(nm).

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

    O(m * n * m * log(m * n)) with list + binary search and a little lucky!! :D :D

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

Problem C was very hard to understand. But B was hackable so I liked the contest

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

I was constantly getting wrong answer on pretest 4. Any possible corner cases? I thought of all possible scenarios, could not find anything :(

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

почему мой код не взялся на проверку? я отправил когда было 3 сек до конца. пока обновлялось, время кончилось, и моё решение не взяли на проверку.

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

Почему этот генератор теста для B получает "FAIL Expected EOLN (stdin)"?

    int n = 1e5;
    int k = 1e9;
    int f = 1;
    printf("%d %d %d\n", n, k, f);
    for (int i = 0; i < n; ++i)
    {
        printf("%d", k);
        if (i != n - 1)
            printf(" ");
    }
    printf("\n");
»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem D: I have Dijkstra in O(mlogn) approach based on std::set which don't passes 19th pretest. Starting vertex is cell of P type. Please any help, comments about my owful code 18199256 or your solutions for this problem.

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

D seems like some pro shit. When's the tutorial getting posted?

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

What am I doing wrong at problem C?

https://ideone.com/fOMtB2

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

Nice round, I have already failed C in system test in the last 3 rounds, hope this time I can be lucky :D

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

How the hell there are more submission for D than E?

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

I really hate when I miss to notice integer overflow, then get hacked 10 minutes before contest, after which I have to resubmit, thus losing 350 points. The only good thing is that after this I managed to hack one other solution :) so I got 100 points back

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

if D turns out to be simple i'm going to shit brix

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

I can't understand C

is there anyone that explain for me?

i spend most time to understand it..

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

In D i was misunderstanding that it has the (1,1) chest initially.That passed three samples....TAT..

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

С НЕТЕРПЕНИЕМ ЖДУ ОБНОВЛЕНИЯ РЕЙТИНГА)))))

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

D зашла с таким хаком: пишем наивную динамику, но для каждого значения x( ≤ p) оставляем 5К ячеек с наименьшим значением динамики. Соответственно для каждого x будет не больше 50002, что вполне заходит по ТЛ. Такой хак как-то можно сломать? http://codeforces.me/contest/677/submission/18200340

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

    Я тоже такое решение написал, но вместо 5000 хранил 100(WA 26).

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

    клетка (0,0) — сундук 1

    клетка (0,2) — сундук 3

    правый нижний квадрат 75*75 заполнен тройками

    клетка (200,200) — сундук 4

    Все остальное — двойки

    Edit: Это если динамика начинается с сундука p и идет вниз, для обратного порядка пример легко построить аналогично

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

How to solve problem C?

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

I love the contest! Surprisingly most of the problems have a simple way to solve :D.

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

Correct me if I'm wrong.

Task E: nothing prohibits non-positive d (it says three integers, not positive integers). With non-positive d set of items under given constraints is empty. So, technically, answer for all zeroes must be one and not zero?

My solution that prints 0 passed, and I think some solutions that printed 1 failed, seems not fair if I'm right =)

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

Problem B says, that each second Vanya does the following:

1) If there is at least one piece of potato remaining, Vanya puts them in the processor one by one, until there is not enough space for the next piece.

2) Processor smashes k centimeters of potato (or just everything that is inside).

So at each second Vanya checks if the next piece can be accommodated. Most of the solutions that I saw, first add whatever can be accommodated, and if at i_th index, ar[i] + remainingAmount > h, they add to the answer remainingAmount/k. But it is also possible that after some seconds that is less than remainingAmount/k, we get enough space to accomodate ar_i. It is clearly given that Vanya does the above two mentioned things each second. Do both of these solutions give same answer? Am I missing something?

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

Can you please explain the time complexity of problem D?

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

How do you people solve problem E?

I thought 10003 divided by a good constant is just fine for three seconds, but my initial attempt took 2x more. Eventually, I managed to squeeze the O(n3) solution into the time limit. Perhaps it's even easier with a superior optimizing compiler such as GCC.

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

I will not use int anymore, I will write all my future solutions using long. this is the second time I fail system test because of using int. is there any disadvantage of using long?

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

#fastreading

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

I think that D sucks a lot. The time limit was chosen very badly. Some solutions with the same complexity: O(n*m*max(n,m)*log(n*m)) passed and some failed because of that.

Besides author provided theoretically strong pretests. People got busy trying to improve their solution as it was getting TLE on pretests. It created an impression that the pretests are strong in terms of performance and once you pass them you should just worry about the correctness.

Surprisingly I spent some time optimizing my solution just to discover that it was failed because of tle in the final tests.

Either time limit should be higher — 3 seconds or pretests should be weaker so that nobody wastes their time improving something which was going to fail anyway.

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

    I didn't analyse many solutions and you may be right about adjusting TL. But, I don't agree about pretests. It's awesome that pretests were strong and it should help many people. People with slow codes can check their solutions with Custom Invocation anyway. So, in general they shouldn't do it not to waste their time? It's risky to implement complexity which won't obviously pass and one must take it into consideration. I don't see why telling someone "hey, your solution is wrong" is bad. I know that later there is info "hey, your solution may be OK because passed pretests" but it doesn't guarantee anything.

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

      I think that I was one optimization away from the acc, so if the pretests were stronger it would be also ok.

      The problem is that they were chosen in such a way, that they were engaging people in solving this problem. Contestants were spending time trying to pass pretests instead of solving other tasks. It was a false help. If they were stronger it would be a real help. If they were weaker, nobody would complain about it as passing pretests guarantees you nothing. But also nobody would bother spending so much time on this task.

      Besides we are speaking about n*m*max(n,m) (obviously pass?) and n*m*max(n,m)log(n*m). In my opinion both should pass easily. If somebody is trying to differentiate solutions worse by factor of log it means that he wasn't confident that the problem was difficult and interesting enough, so he made time limit more restrictive.

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

        It was a false help for some participants, a useful help for others (I had many things wrong and catched them one by one, thanks to pretests). That being said, I see your point now. But I think it's hard to adjust pretests so perfectly.

        Unfortunately, if you want to allow O(n3·log(n)) to pass easily, then it may also allow squeezed O(n4) to pass. I think that the chosen constraints were ok — there is intended O(n3) (passes easily) and one may risk and write O(n3·log(n)) carefully, to also get AC. Fine for me. One may get TLE a few times but in the long run it isn't a big deal and I don't see a better solution.

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

Okay Wild_Hamster, you beat me this time, well done!

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

Thank to all for such contest. It was really unexpected thing for me to be in top-10. :D

I was writing it normally, solved ABC, then got TL #19 on D. Then I thought: "I need to get maximum points here" and started hacking. :D When I opened my room there already was a guy with 1 hack. After 1 refresh I saw +2 near him. Then +3 were near me. :D And when I only refreshed my page, it said "Sorry, your balance is X, you can't surf internet anymore". As you already understood, X is some negative number. :D I ran from home to nearest terminal, which is not near my home, :D put cash for my dear internet provider, came back, made 2 more hacks, optimized my TLed D solution in some shitty way and it passed systests. :D

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

Perfectly right submission http://codeforces.me/contest/677/submission/18209483 calculating 3^n. WTF test 9 has no input. I was lied. they said length was more than 1? In contest solved two problems but shouldve used long for t in 2B but i used int for a perfectly correct answer :(

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

is there anyone that explain to me D?

testcase #4

5 5 5

4 2 1 2 3

3 4 4 2 2

3 4 1 2 4

2 1 5 4 2

4 3 1 1 2

why answer is 9?

what i understand is 2: (1,2) -> 3: (2,1) -> 4: (2,2) -> 5: (4,3) thus ans = 7

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

Congratulations to Div. 2 user fake_fake who wins the round! 1st place from the 3rd try! Nice progress, man...