:3
Everything is barely weeks. Everything is days. We have minutes to live.
- about me
- Github: @r1bb1t-h0l3
Everything is barely weeks. Everything is days. We have minutes to live.
Still on my Learn to Code by Solving Problems binge, and I found this problem quite interesting, so I decided to share my solution and thought process behind it.
The USACO Tic-Tac-Toe problem is a variation of the classic game, with cows claiming squares and competing for victories individually or as pairs. The full text can be found here
The reason I decided to write this up is because initially I had solved it in a way that should have worked (to my mind), but didn’t (around 50% of the test cases failed). I couldn’t quite figure out why and had a look at the solution provided. Turned out that the magic ingredient I was missing was sorted tuples.
Posted · Author ribbit
Disclaimer: I have no idea why this problem is called “Misa” when the protagonist’s nme is “Mirko”. I can only assume that “misa” is maybe Czech for “mass”, as the problem is about shaking hands with people at church:)
Anyway, I really enjoyed this problem, and I want to explore the approach and logic behind solving a seating arrangement problem involving handshakes. The algorithm I came up with is designed to calculate two key values:
1. The number of existing handshakes in the seating arrangement.
2. The maximum additional handshakes possible if Mirko takes a seat optimally.
This solution employs a grid traversal algorithm with careful attention to boundary conditions, allowing it to work well for seating matrices of varying sizes.
Posted · Author ribbit
This one was definitely tough! By this one I mean this Decoding DNA problem from dmoj.ca. I have to admit that simply understanding the task was probably at least half the challenge, as I am not very familiar with how DNA works.
Posted · Author ribbit
In Python a set is considered to be an unordered collection of unique elements. I found out about this method when solving the From 1967 to 2013 Problem on DMOJ. I actually wrote a different solution initially, one that iterated through 4 digits, comparing them to each other, but then I noticed that the input can go up to the tens of thousands. Also my submission only passed half the test cases😩.
Posted · Author ribbit
Over the past month, I’ve been focusing on improving my fundamental programming skills, not by learning more Python tricks, but by strengthening my core understanding of programming concepts. A lot of this has involved working on DMOJ problems and reading Learn to Code by Solving Problems by Daniel Zingaro.
Recently, while solving a problem from the Timus judge, the book introduced the top-down approach. This approach has been incredibly helpful for me, especially when it comes to structuring code and using functions effectively. The top-down method encourages you to start by breaking down a task into broad steps and then narrowing down what each function needs to accomplish.
Posted · Author ribbit
This week I finally hit 50 solved problems on DMOJ! Problem number 51 for me was Rue’s Rings
Posted · Author ribbit