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

Автор Senku, 12 месяцев назад, По-английски

I’ve never used a linked list in a CP problem. Was wondering if it is ever useful?

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

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

Yep used it a few times but u can instead link elements using prev and next arrays!

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

Maybe. You might check my blog: https://mirror.codeforces.com/blog/entry/140442

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

you can write solutions fast in some problems if you learn link list (next and prev arrays)

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

I remember using it only once, in this problem: https://mirror.codeforces.com/contest/1131/problem/F

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

Yes. Sometimes setters give a problem on a linked list, but as participants don't know how to use it they code treap instead.

99% solutions for problem L in this contest are treaps (linked list is replacable by deque there though).

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

Linked list is close to the best graph representation method.

Linked list is the objectively optimal (figuratively) way (both memory and constant factor efficient) to represent $$$m$$$ integers distributed across $$$n$$$ sets in $$$O(n+m)$$$ memory. It needs the assumption that each integer can appear in at most one of the sets at any time.

A doubly linked list is present as a standard SQRT-structure that supports arbitary insertions and removals.

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

The only linked list problem I saw in a contest was Atcoder abc344_e Insert or Erase, but it was solvable using a map

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

Task from Educational Codeforces Round 161 — https://mirror.codeforces.com/contest/1922/problem/D