The code of hw4 will be similar to hw3 due to the hw4 problem is the derivation of hw3. To be honest, I hadn't finished the hw3 really well so hw3 was unfinish and that I started to write the code on the basis of hw3 to write hw4. That's the reason that they were so similar.
To run the program in the server of the course lecturer to check if the result are identical to the answers provided. It totally took about 15 mins to run and check all testcases.
To run the program in the server of the course lecturer to check if the result are identical to the answers provided. It totally took about 30 mins to run and check all testcases.

