Implementation problems

Revision en1, by IanISam, 2023-02-06 07:12:52

Last div 2 problem D is quite difficult to implement. My solve after contest was over 150 lines submission:192414856 and in-contest I struggled to find an efficient way to implement the problem. Also recently, as I’m solving harder problems, the problems become more tedious and difficult to implement. To the point where I cannot reasonable be able to solve them in-contest(maybe I just type slow~60wpm for programming~100wpm normally). One problem is that I’m writing lots of similar code(but not similar enough) where I can’t find an efficient way to come up with an algorithm for all the copy and pasting. In the case of the problem mentioned previously, it’s very inefficient to write all possible pairs with w i and n. And if there are more characters, I would not be able to solve the problem practically. Sometimes as well, I’m not sure if there exists a data structure or method for a specific purpose. For example, E on last div 2 contest could be solved if I have a data structure with o(1) insertion and o(1) replacement(as well as being indexed). So I have three major questions:

  1. Are there any data structures that I’m unaware of? I know ArrayLists(Java), arrays, stacks, priority queues and queues, as well as ordered and unordered maps and sets. I am also moderately aware of the functions of the LinkedList but I find very little usage with it.

  2. Smart methods for handling strings, pairs, other misc data types. I am aware of StringBuilder.

  3. How to maps solutions into code efficiently. I do read other people’s solutions but I usually don’t understand them very well. I understand that it comes down to practice(I solve a lot of problems across multiple platforms), but many times I find my solutions very impractical to implement.

Ex: https://codeforces.com/contest/1741/problem/F

Solve idea

Thank you all for sparing time out of your day for reading this post, hopefully I’m not the only person who has this problem since you are all speed gods.

Tags implementations

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English IanISam 2023-02-06 07:12:52 2280 Initial revision (published)