Тёмный

[CSES][Sorting and Searching] Collecting Numbers II 

NeatlyStructured
Подписаться 3 тыс.
Просмотров 10 тыс.
50% 1

cses.fi/proble...
This problem is continuation of "collecting Numbers" that you can find here:
cses.fi/proble...
and its video editorial here:
• [CSES][Sorting and Sea...
In this problem, we have to handle updates that consist of swapping two elements.

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 30   
@riebeck1986
@riebeck1986 3 года назад
Your series have been really helpful. Thank you !!
@neatlystructured
@neatlystructured 3 года назад
Thank you so much!
@tagberli
@tagberli Год назад
plot twist: he is not explaining the problem but he is actually solving it
@avgspacelover
@avgspacelover Год назад
amazing series!
@secret-saad
@secret-saad 3 года назад
thank you
@neatlystructured
@neatlystructured 3 года назад
Welcome!
@nivalderramas
@nivalderramas Год назад
Thanks
@saurabh.gupta22
@saurabh.gupta22 2 месяца назад
Great Explanation and Great video hats off to you , it is really helpful
@Giovanni-rh1pw
@Giovanni-rh1pw 2 месяца назад
Why does my solution not work? I basically used the same code as in the collecting numbers problem, but for each query I check whether the first integer A's position was ok in relation to A - 1. Then I do the same after swapping. (I do this for both numbers). If it was ok before swapping and not ok after swapping, increment 1 to the answer. If it was not ok before swapping but it now is, decrement 1. I dont understand why this doesnt work
@sushankmishra53
@sushankmishra53 Месяц назад
Counterexample : Current order: 4,1,2,5,3 no. of rounds(acc. to ur soln): 2 swap position 1 & 5: true ans. is 3 but solution gives 2 again; didn't consider that when 4 is swapped to 5th position, 5 at 4th position creates an inversion as well both predecessor and successor of the number has to be considered to check for inversion after swapping
@ChiragKava
@ChiragKava 3 года назад
Thanks , i listened to your explantion and coded it myself :)
@neatlystructured
@neatlystructured 3 года назад
Sure! So glad i could help!
@MyPlanetIsPluto
@MyPlanetIsPluto 2 года назад
Can you link a copy of the code for this? I'm trying to troubleshoot my code and it would be helpful to debug using working code to compare
@neatlystructured
@neatlystructured 2 года назад
here you go: github.com/ars-longa-vita-brevis/CSES/blob/master/Sorting_and_Searching/collectingNumbersII.cpp sorry for the late reply
@arunpanwar4152
@arunpanwar4152 2 месяца назад
Woow man osm ❤
@rajathkumar3822
@rajathkumar3822 3 года назад
Thankyou bro. U Just made to start coding ☺️☺️☺️
@neatlystructured
@neatlystructured 3 года назад
Thaaank you so much !
@raghavendrac4710
@raghavendrac4710 6 месяцев назад
Great explanation. Thank you
@neatlystructured
@neatlystructured 6 месяцев назад
You are very welcome!
@hrishiharshsengar9499
@hrishiharshsengar9499 3 года назад
just subscribe to him! really helpful content:)
@neatlystructured
@neatlystructured 3 года назад
Thank you very much!
@lightyagami5755
@lightyagami5755 2 года назад
what a great explanation, understood everything. thank you so much
@secondthread-uc9bd
@secondthread-uc9bd Год назад
key observation : concerned only with consecutive ordered pairs
@nurbeknurbagi9746
@nurbeknurbagi9746 Год назад
thank you very much
@saefaburaed8654
@saefaburaed8654 3 года назад
Thanks a lot!
@neatlystructured
@neatlystructured 3 года назад
You are very welcome!
@KIXEMITNOG
@KIXEMITNOG 3 года назад
Nice!
@neatlystructured
@neatlystructured 3 года назад
Thank you !
@2pacbiggie986
@2pacbiggie986 Год назад
n1
@GauravKumar-pc8iw
@GauravKumar-pc8iw 3 года назад
Can u provide code link
Далее
[CSES][Sorting and Searching] Movie Festival II
13:47
Просмотров 3,4 тыс.
[CSES][Sorting and Searching] Maximum Subarray Sum II
21:36
[CSES][Sorting and Searching] Traffic Lights
17:45
Просмотров 6 тыс.
Subarray Divisibility (AtCoder)
15:56
Просмотров 22 тыс.
Fast Inverse Square Root - A Quake III Algorithm
20:08
[CSES][Sorting and Searching] Towers
21:08
Просмотров 2,8 тыс.
[CSES][Sorting and Searching] Room Allocation
24:32
Просмотров 3,9 тыс.
Compilers, How They Work, And Writing Them From Scratch
23:53