-
Notifications
You must be signed in to change notification settings - Fork 0
D2 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| long long *node; | ||
| long long *point; | ||
| long long buffer_size; | ||
| long long size_two; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size two очень странное название
| long long *point; | ||
| long long buffer_size; | ||
| long long size_two; | ||
| long long size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше парами располагать buffer + buffer_size, point + size и пустые строки между парами или комментарий
| void SiftUp(long long v); | ||
| void SiftDown(long long v); | ||
| public: | ||
| Heap(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
списки инициализации
| size = 0; | ||
| buffer = new long long[buffer_size]; | ||
| } | ||
| ~Heap(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
правило 3х/5ти
| } | ||
|
|
||
| void Heap::GrowBuffer() { | ||
| buffer_size = buffer_size * 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а нельзя функции роста буфера объединить?
| node[v] = second; | ||
| node[v/2] = first; | ||
| std::swap(buffer[v], buffer[v/2]); | ||
| v/=2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
код смены элементов можно вынести в общую функцию
Фаталиев Джавид Б05-125 https://codeforces.com/group/PVbQ8eK2T4/contest/347382/submission/133096238
случайно добавил C2, но D2 октрывается