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

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

Привет, Codeforces!

Рад пригласить вас на Codeforces Round #526, который пройдет 10.12.2018 19:35 (Московское время). Раунд будет рейтинговым для обоих дивизионов.

Задачи были подготовлены мной, TheWayISteppedOutTheCar, xoxo, kiyotaka.

Большое спасибо ismagilov.code, Kuyan, 300iq, alexey_kuldoshin, Jatana за тестирование задач, arsijo и vintage_Vlad_Makeev за помощь в подготовке раунда, а также MikeMirzayanov за системы Codeforces и Polygon.

На раунде вам будет предложено 6 задач в каждом дивизионе и 2 часа на их решение. Разбалловка будет объявлена ближе к началу раунда.

UPD:

Разбалловка в Div. 1: 500-1000-1500-2000-2000-2500

Разбалловка в Div. 2: 500-1000-1500-1750-2250-2750

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

Div. 1:

  1. Radewoosh

  2. DearMargaret

  3. Endagorion

  4. ksun48

  5. Um_nik

Div. 2:

  1. Muffinhead

  2. Usu

  3. arjunsanjeev7

  4. IAmNotGood

  5. tyler

UPD: Разбор

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

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

у вас время сломалось

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

I think the date is wrong

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

I am confused.

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

Aww, new codeforces round, new chance to fall!

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

I am very interested in knowing what vintage_Vlad_Makeev is planning to do??XDD

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

Time is always a severe problem for us Chinese fanatic.

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

“Is this rated?” hURr DuRR

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

i hope that problems will be graduated in terms of difficulty ^^

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

yey i cant wait for all of you to lose rating! :D

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

2300

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

Again a new chance to restart coding...

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

does cf stops producing 5 problem Div2.s ?

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

Wish for 2400.

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

how many problems are shared between the divisions ?

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

Yes I wont lose rating

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

Сколько вам заплатил Vk?

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

Div2A was such broken english that I couldn't comprehend the problem statement. After reading the statement multiple times I reached an understanding which was in conflict with pretest 1 answer. I submitted a question and nobody answered it. So I guess I'm just gonna skip this round then.

Please don't google-translate russian problems into english. If you can't write english problem statements, ask help from someone who speaks english. If you can't explain a simple problem (such as div2A level) in an understandable way, please don't write problem statements at all.

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

How can i register now?

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

Give more explanation for Div2C. Really bad english.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится -29 Проголосовать: не нравится
Комментарий удален по причине нарушения правил Codeforces
»
8 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

RIP problem statements

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

Lol. C was harder than D and E. How to solve C?

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

How to solve DIV1B?

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

Was the intended solution to E convex hull trick? If so why is it after C and D in the list? :Dd

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

can someone explain div 2 C problem and its solution?

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

Коротко о том как потерять 40 позиций.

https://codeforces.me/contest/1084/submission/46866248

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

That feeling when you spent nearly 1h to think about 1A but finally realized that the condition that one should have enough gas to pass through a road is useless.

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

how to solve C without seg tree??

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

Div2D test 7 anyone please?

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

early system testing nice ^^

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

For div1E, is it enough to use long double?

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

C and F were very good problems! (Too bad I didn't solve any of them :(.)

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

i think div 1A should be easier (people usually leave the contest after they think the first problem is too hard for them, or at least it need a long time to solve it).

the number of participant in this contest is less than 400.

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

Why are constraints so tight in E? My solution worked 1840ms/2000ms on pretests (I don't know if it will pass, although I'm 100% sure idea is fully correct) and it had 64-bit integer overflow issues. So why did you do so? Am I obliged to prepare very fast CHT beforehand to pass on this problem?

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

can someone please share their approach to Div2 D ?

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

    DFS, where each node returns the best path in its subtree that ends at this node. Do this while maximizing the answer among the sum of best 2 children of each node with each other, i.e sum the paths returned from the best 2 children and check if they're better than your answer, they resemble the best path passing through this node, also try taking the best path alone, or just the gas of the current node.

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

    dp on tree.

    first, make the tree rooted. dp[u] = maximum gasoline that can be starting from u and ending to node that have u as its ancestor

    for each node, you can find the maximum of the path passing that node by finding the best two children of that node.

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

    Centroid decomposition — force the centroid to have a depth of 0, and find depths of subtree accordingly (add weights, subtract lengths of edges).

    Then add in the w[centroid] when considering the answer.

    Unfortunately,

    I put for (auto e : arr) ARR.insert(e); in the wrong layer of looping causing it to do nothing at all! :(

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

    First notice that an edge and a vertex only comes into the picture along with some other vertex when w(vertex)-w(edge) is positive. In this case it will only increase the gasoline upon reaching some vertex. You need to maximize this.

    The way to do it is calculate (in) value for the vertex which denotes answer if you start with this vertex and travel down...Also calculate (out) for each vertex which denotes max answer you can get starting from the node and not traversing the children of it.

    As wewark says keep 2 best children for it to do it in linear time.

    It is the in-out dp trick. Sad it is for I wasn't able to complete its implementation on time.

    Below is the link to its video tutorial. https://www.youtube.com/watch?v=Xng1Od_v6Ug

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

Last week I was mocking .ckodser. for using "ll" no matter what , even as a loop variable. And today I got two wrong answers in the whole contest , both due to the above issue :|. Guess that's the universe slapping in my face ... :O

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

I don't want to make int128 library only for codeforces(why codeforces working on 32bit????)

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

Can we solve DIV2 D using in-out dp ? for every node , taking max value in inside subtree and max from outside subtree , and now curnodeval+max(inside_value,outside_value) ! we will check this for every node and taking out max of all ! P.S : value in a subtree is sum of values of nodes — sum of values of edges !

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

Fast judging, pretty good.

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

And btw, apart from C and F being good problems which I mentioned before, there were a few annoying things. I see that TLE in C was pretty tight (I currently see 1 AC and 2 TLEs on 100/112 tests among my friends) and it seems TL in E pretty strict as well and in E we needed to check whether ab>=cd where these products could be as large as 1027. Why weren't the constraints lower so that it could fit in LL? It took me something like 5-10 minutes to solve this problem and code it apart from doing this check which took me 26 minutes xDDD. CF doesn't have int128 (ノಠ益ಠ)ノ彡┻━┻, long doubles are shaky and all other ways are troublesome and require a lot of care.

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

How about Div 2 C?

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

    it's hard for me to explain but I can give the hint to forget about all characters that are not 'a' and 'b', and count number of adjacent 'a's and store it in vector. Then find formula for it. Check my submission for maybe more info about formula.

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

    It's simple combinatorics.

    You need to have atleast a 'b' if you consider more than 1 'a's of the sequence. So, what you can do is count 'a's in each segments seperated by a 'b'. Now, suppose for some segment you have x a's. So, you have x+1 choices(select 0, 1, ...x) to select 'a'. Multiply each segment's (x+1) values. Now, you need to subtract 1 as you need to have a subsequence of length atleast 1.

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

    hey i used a dp approach: consider there are x continuous segments of b's in the string which divide the string in (x+1) parts. Let the no of a's in the (x+1) segments be a1,a2,......a(x+1). Then DP[i]=(a[i]+a[i]*DP[i-1]+DP[i-1])%Mod, DP[i]->no of ways considering first i 'a' segments. Base case: DP[1]=a1 and final answer would be DP[x+1]. Also you would need to check separately when the string would contain no 'a' or no 'b'.

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

Div1A, statement "Nut can't choose a path, which consists of roads, where he runs out of gasoline" does not affect the answer? Interesting.

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

Cheaters 46874750 46876196 ,I suppose that you will not do anything as always MikeMirzayanov ?

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

KAN MikeMirzayanov cookiedoth

You better have developed plagiarism checker. Check some codes and they are almost the same. No doubts most of them are copied from sites like "ideone". For example, two same submissions:

https://codeforces.me/contest/1084/submission/46875019

https://codeforces.me/contest/1084/submission/46876091

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

Huh, it took me approximately 5 years and 5 months (since the first c++ code), but this moment is worth it, even if it's just a moment :P

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

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

2 sysfails today :( but at least i got a christmas candy cane :)

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

Congratulations Radewoosh.Number 1 on both rating and contribution.

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

This Code of Problem B: while (sum < s){ sum += n; num[0]--; } I check is case: 1 999999999 1000000000 It's running for 2000ms on my computer,But gets an Accept in system test....

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

Can anyone provide a proof why this 2B passes??
Tried around 10-15 tc but It didn't fail.

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

E was solvable in 10-15lines with just sorting+deque without cht.46878899

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

Thank you, Good contest, Great problems, Nice pretests.

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

can anyone explain me div 2 c with example

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

Div2E states:

Recently, the Fair Nut has written k strings of length n, consisting of letters "a" and "b". He calculated c — the number of strings that are prefixes of at least one of the written strings.

So he calculates all the possible strings that would be prefixes? Not only those k of length n, that where written?

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

Can someone give me some links where I can learn about convex hull opt? The old ones that are on codeforces blog's does not work.

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

.

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

Hi I got accepted in problem B(div.2); but there's a test case that is not in your tests, but I will get TLE on it. The test case is this: 1000 10^12-1 10^9 10^9 10^9 .... please add this TC and rejudge

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

Guys, what is needed to solve Div2 Problem D? I know DFS but I am not able to understand the approach to be used for this problem. For me, the editorial above is providing no clue/ help. Can someone help me with some explanation on this problem?

Thank you.

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

    Think of it like this : You need to search for a path. So, for each node, you consider its subtree. Now 2 cases : a) You need to find the best one-ending path. That is, find the best path that starts somewhere in the subtree and ends in this particular node. This is the path that can be extended by the ancestor node. So, you need to store it in the DP state. b) You need to find the best possible path in this subtree. Also, it should pass through this particular node. The path in a) is one of them. The others can be found if we combine the best paths from the 2 of the children subtrees. Which we can do by sorting the children DP states.

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

how is Radewoosh pronounced?

is it like Raydwoosh or Ra-De-woosh?

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

.