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

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

1473A - Замена элементов

Идея: BledDest, adedalic

Разбор
Решение (Neon)

1473B - LCM строк

Идея: BledDest

Разбор
Решение (Neon)

1473C - Хватит инверсий

Идея: adedalic

Разбор
Решение (adedalic)

1473D - Программа

Идея: BledDest

Разбор
Решение (awoo)

1473E - Минимальный путь

Идея: Neon

Разбор
Решение (Neon)

1473F - Странное множество

Идея: BledDest

Разбор
Решение (BledDest)

1473G - Плитки

Идея: Neon, adedalic

Разбор
Решение (Neon)
  • Проголосовать: нравится
  • +133
  • Проголосовать: не нравится

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

The terminology of using "path" for problem E was a bit misleading, since path is normally defined as a walk in which all vertices are distinct, which may not be necessary in this case. Would have given greater clarity if "path" was defined within the problem.

Otherwise, great problem with an even better solution.

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

fixed

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

I know this will sounds biased, but is n = 1000 necessary for G? I've read the official solution, and assuming that the constant factor of NTT is 1, then that solution would require somewhere around 9e7 operations in worst case (which is something around multiplying 2 polynomials of size 5e6). Of course, the official solution runs in a mere 654ms on the hardest test, but it kills pretty much any recursive NTT solution. (I swapped the solution's NTT with an recursive NTT, and it TLEd on custom invocation on the hardest test, and Codeforces gives 15000ms on custom invocation.) While using recursive NTT itself is folly, I've yet to seen a NTT problem on Educational rounds that forces the participant to use iterative NTT. Which leads to the original question: is this problem intended to introduce iterative NTT to more experienced participants, or was it just an overtly pushed limit to fight brute force?

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

During the contest , what was your lane of thought while solving C ? How you approached it before reaching to the solution?

I saw that even SecondThread (in his screencast) and nika-skybytska (in comments) misread the problem C twice and same happened with me . Finally i wrote brute force and observed the pattern and passed somehow.

Though after seeing the solution it doesn't seems to be difficult , we just needed to observed that in palindrome number of inversions would remain same.

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

Video Tutorial for problem A,B and D link of problem D : https://www.youtube.com/watch?v=botAQ-AZNOQ

link of problem B : https://www.youtube.com/watch?v=H3qBEDYwwX4

link of problem A : https://www.youtube.com/watch?v=YjC6CcxYxo8&t=263s

Hope you guys will enjoy and understand the intution behind the solutions !!!

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

Here is an attempt to make an unofficial video editorial of Educational Round 102 by COPS IIT BHU (English) (Problem A-E).

Blog link : https://mirror.codeforces.com/blog/entry/86815

Do check it out. https://www.youtube.com/playlist?list=PLLt4yMoVgczWm1VzN3O4y29VElipDNJ1H

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

Can we solve the D problem using segment trees also ? If yes can someone explain their approach along with code link ?

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

can anyone explain the solution for problem E .

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

    sorry for my poor English
    Firstly,add "extra information" when you running dijkstra.Original dijkstra only cares about which point is visted,but now we add two new information on every point.Like copy every point 4 times.When dijkstra is over,we get the shortest path from 1 to others,and the conversions in editorial works based on the answer we get is the "shortest",and "shortest" means we must delete the maximum edge's cost,and multiple the minimum edge's cost twice.This exactly fits the problem.

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

in what world G is a div 2 problem? (or under 2100)

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

Are there any problems similar to E ?

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

Problem C, maybe I'm misreading forever and I can't figure out where it is, can someone help me?

For example n = 5, k = 3, sequence a will be "12321", and inversions of "12321" equals to 3.

The answer p is "321" then sequence b will be "32123", and inversions of "32123" equals to 4 ??

It exceeds the total number of inversions in a??

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

finally...... rating:1599 :(

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

What kind of solutions does the ML in F intend to block?

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

.

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

Can someone please explain D , went thorugh the editorial multiple times but still ain't clear ? Thanks !

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

May I ask why $$$ans_{i, j} = \sum\limits_{k=1}^{m} \binom{a_i+b_i}{b_i-k+j} ans_{i-1,k}$$$ is established in problem G?

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

For G:

1e3 * 1e5 * 17 with constant factor C = 1.7e9 * C.

For NTT, obviously that C > 1.

And it's quite easy to reach the worst case.

How dare you set a 1e3 there.

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

Hi @BledDest,

For the problem F and the input:

2
1 2
100 -200

I guess the network should look like

Where is min-cut here? And where is the flow?

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

Hey can someone provide me a case where my submission for E fails? Almost all tests other than samples are too big to simulate by hand and I'm not able to think of a case :(

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

Can anyone give me a visualization of new graph in problem E? Maybe using the first sample test please. I could not imagine how that graph may look like.

Thanks in advance.

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

    There is no new graph . Here dp[u][0][0],dp[u][0][1],dp[u][1][0],dp[u][1][1] are not effected by each other and thus can be seen as independent nodes with all edges attached to them similar to u.

    Few definitions (similar to editorial) :

    dp[u][0][0] :Minimum Path length from vertex 1 to u such that each edge in path is counted once .

    dp[u][0][1] :Minimum Path length from vertex 1 to u such that one edge in path is counted one more time.

    dp[u][1][0] :Minimum Path length from vertex 1 to u such that one edge in path is subtracted.

    dp[u][1][1] :Minimum Path length from vertex 1 to u such that one edge in path is counted one more time and one edge in path is subtracted (Note that both type of edges can be same and in that case it will be equivalent to dp[u][0][0]).

    Answer for node u will be dp[u][1][1] because it fits definition in the problem and the edge subtracted will be always maximum and edge added one more time will be of minimum length (see proof in editorial).

    Let's consider graph with n=3,m=2 .Edge 1----2 with weight 3 , 2----3 with weight 6 . Initially dp[u][x][y] = Infinity for all nodes and all values of x and y .

    clearly dp[1][0][0] = 0 . Now transitions :

    dp[2][0][0] = 3 + dp[1][0][0] = 3 . dp[2][0][1] = 3 + 3 + dp[1][0][0] = 6 . dp[2][1][0] = dp[1][0][0] = 0 . dp[2][1][1] = 3 + 3 — 3 + dp[0][0] = 3 . As expected answer for node 2 is 3.

    dp[3][0][0] = 6 + dp[2][0][0] = 9 . dp[3][0][1] = min(dp[2][0][0]+6+6,dp[2][0][1]+6) = min(15,12) = 12 . dp[3][1][0] = min(dp[2][1][0]+6,dp[2][0][0]) = 3 . dp[3][1][1] = min(dp[2][1][1]+6,dp[2][0][1]) = min(9,6) = 6 . As expected answer for node 3 is 6.

    It can coded exactly as Dijkstra where we start from dp[1][0][0]. See the code in editorial it's very short and easy to understand.

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

is there any video editorial for F ??

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

can someone explain where i am wrong in Probem E

i am getting WA on test 5

although i did similar as mentioned in editorial.

SUBMISSION

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

Problem F is Closure problem.

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

Can someone explain this to me? (taken from editorial problem E) We can notice that on the shortest path, the maximum weight edge was subtracted and the minimum weight edge was added. Let's assume that this is not the case, and an edge of non-maximum weight was subtracted from the path, then we can reduce the length of the path by choosing an edge of maximum weight. But this is not possible, because we considered the shortest path. Similarly, it is proved that the added edge was of minimal weight.

How exactly do we reduce path length by choosing the edge of maximum weight ???

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

Что это за Разбор

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

What is this, could you explain better?

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

Never mind

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

Don't know why you are taking max and min with 0 in solution of D, instead of taking max and min with d. Taking d would have been a better choice as it is a more general way of computing suffix max and suffix min.