Powered by Starship v1.3
hello world
Apr 14 2025
10:00 PM

hi

...

read more

Cheesing CSES Cut and Paste with a skiplist
Mar 27 2025
8:16 PM

https://cses.fi/problemset/task/2072/

Treap is the intended solution to this task, but I didn't know treap well enough to write it on the spot. I did however know skiplist (which imo is less complicated) and so I ended up implementing this goofball:

...

read more

tags: programming cses

A possibly unusual way to solve CSES Increasing Array Queries
Mar 26 2025
12:08 PM

https://cses.fi/problemset/task/2416/

I had been kinda stuck on this for a while, mostly because I was trying to use some weird segtree bash.

...

read more

tags: programming cses

Moments in time
Feb 17 2025
9:19 PM

A collection of photos from years past...

read more

tags: media

when the summer camp essays are essaying (hi joseph)
Jan 30 2025
10:47 PM

I'm applying for a couple summer camps right now, and one of the applications included this prompt:

What person or event in your science and mathematics education has been the most influential in your decision to pursue a career in science or mathematics?

Here's my response. I think it speaks to my core philosophy pretty well:

...

read more

tags: life

Snow day(s)
Jan 21 2025
10:54 AM

And I don't want the world to see me
'Cause I don't think that they'd understand
When everything's made to be broken
I just want you to know who I am

- "Iris", The Goo Goo Dolls

I have offline query school for the next two days!!

We didn't get a huge amount of snow, only two or three inches, but the temperature is so low that it isn't melting naturally or artificially.

So, I have asynchronous school. Unfortunately this is happening literally when my finals were supposed to be, so they're being pushed back into 2nd sem..

also I need to update blog more often lol

A post made for seemingly no reason
Jan 7 2025
11:30 PM

the dragonfly is such an enigmatic, dynamic creature. its rise and fall on ghostly wings is unpredictable as chaos itself.. ehh what am I saying.... let's just say, it rises, yet again. if you know you know! ;)

Funniest DFS ever
Dec 27 2024
11:41 AM

Continuation of my previous post about pattern-matching.

Previously, I explained how to use a depth-first-search of a trie to compute pattern-matchings in a set of strings. However, explicit trie used too much memory for the specific task I was trying to apply it on. (64 megabyte limit)

So I took some advice from Alternet and made the trie implicit - rather than even storing intermediate nodes, the entropy of the strings being stored in the trie was low enough that storing each query individually and sorting it took up less memory than a trie. Then this sorted array could be "dfsed" with divide-and-conquer.

...

read more

tags: programming

A funny pattern-matching technique
Dec 26 2024
11:19 PM

Hey yall. Been a while.

I 'discovered' an interesting way to pattern-match certain types of strings today. Extended writeup on Codeforces

Enjoy!

tags: programming

Floyd-Warshall arises naturally from matrix operations
Nov 30 2024
12:31 PM

Recall that the Floyd-Warshall algorithm computes shortest paths between every pair of nodes. It does so by repeatedly "combining" paths into longer ones: Given three distinct nodes a, b, c form the new path a -> c from the two paths a -> b, b -> c and check if it is an improvement.

How does this "arise" from matrix exponentiation?

...

read more

tags: programming

Atcoder Beginner 382
Nov 30 2024
8:47 AM

It's been a decent while since I did one of these. Speed still seems to be ok.

Solves:

  • A @ 1 minute 6 sec. Very standard

  • B @ 4 minute 4 sec. Also standard

  • C @ 9 minute 10 sec. Wrote some montonic array & binary search

  • D @ 14 minute 49 sec. DFS-like ordered sequence builder

  • F @ 52 minute 12 sec. RMQ + range set segtree on sorted list

tags: programming atcoder contest-logs

PUMAC :D
Nov 22 2024
5:31 PM

today felt kinda surreal ngl

so my school is fake asf and is giving us the entire week of thanksgiving off.. as a result I had tests / inclass essays / projects due from literally every class yesterday and today :skull:

but anyway none of my classes had anything going on past noon + there were club events and stuff going on

this weekend im gonna be going to PUMAC with some friends - probably gonna absolutely throw but wtv

tags: math

AMC 12B
Nov 13 2024
3:52 PM

Definitely easier than 12A. I think I got 20 correct / 5 skip = 127.5 total :D

tags: math

AMC update
Nov 7 2024
8:38 AM

I think I got 108 pts (AC x16, WA x1)

Honestly not terrible, I'll take it.

tags: math

AMC 12 A
Nov 7 2024
8:12 AM

Took AMC 12 yesterday, it went ehhh

First of all, performance: I solved 17 questions, left the rest blank.. Overall I was limited on time, but there were also a rather large number of problems that I didn't know how to solve.

I do feel though that the problems were.. a lot less 'standard' than previous years? This might just be an artifact of my lack of comp math practice over the last year, but several people I have talked to seem to think the same.. And also, if so, this would probably be good for me seeing that I haven't properly practiced in so long that I forget most of the usual constructions...

Anyway, at the very least, this can serve as practice for the 12B :D

tags: math

Who could have guessed
Nov 3 2024
3:11 PM

that the thing which most negatively impacts my productivity is idling on discord

oh and listening to music too, it seems.. rip

Tarjan's algorithm is cool
Nov 1 2024
2:17 PM

This post is protected by encryption. Unlock

FGouHpgtkAaTc9eSWB9Xvn15fzXBEmeVHeC0Mlz2IaFSMFfFsaH44HGO5Gc+9hWC1s+EGgxJhH/Wi6IhNQFRZA==

1BBb+QMvnTIAzvw5Uld43lx8rkKTzR+WW8bgIUJN+L0=


Solved CSES Coin Collector - first time working with SCC!

but ya tarjan is cool :D

...

read more

tags: programming

Encrypted posts!
Oct 30 2024
5:56 PM

This post is protected by encryption. Unlock

e8URR5thE7IdPweCFoFlAoQhc+Z+tnTIONC/N9VR/Kg=


Encryption is done via AES. The password used above is a good password, enjoy!

tags: programming starship-dev

Non-linear problem difficulty
Oct 27 2024
2:54 PM

"This ARC also serves as a qualification round to select the 18 contestants for the Japanese national finals, making it significantly more difficult than a regular ARC. Due to circumstances, we replaced the tasks and changed the point values. Since there are no easy tasks, the difficulty level of solving one or more tasks has increased. Please be careful. Since the difficulty level is flat, we recommend reading all the tasks and not necessarily solving them in order."

pov i forget to read this and consequently spend the entire contest on A (and fail to solve)

...

read more

tags: programming atcoder

fun trie problem
Oct 26 2024
10:27 AM

This problem is from today's atcoder beginner contest

You are given a list A of lowercase English strings.
For each string S in A, solve the following problem:

You can perform two operations to S:

- Delete the last character of S (if it is non-empty)
- Add any lowercase character to the end of S

Find the minimum number of operations to convert S into either the empty string or a string that comes before it in A.

This kind of screams trie...

read more

tags: programming atcoder contest-logs

So much for regular updates
Oct 19 2024
12:06 AM

idk, recently just not much going on / too busy to post / too lazy etc. School been alr, had psats a while back. Bunch of tests/projects recently but nothing really memorable.

Currently in LA; parents at 20-year Caltech reunion. Can't do ABC/ARC both due to lack of time and also time zone.

Really interesting event though! Lots of accomplished people, interesting presentations, etc. Been doing a lot of self-reflection recently as well.

ARC is scary
Oct 13 2024
1:44 PM

Took Atcoder Regular Contest 185 this morning. I had done one ARC virtual in the past, but that one had relatively more 'normal' questions than today's contest. I think it went alright? I don't really have a sense of scale with ARC yet.

...

read more

tags: programming atcoder contest-logs

Atcoder Beginner Contest 375
Oct 12 2024
10:06 AM

I should put more effort into these surely...

read more

tags: programming atcoder contest-logs

Atcoder Beginner Contest 374
Oct 5 2024
10:27 AM

Woke up 10 min before contest, slow start but wow.. good contest I think

...

read more

tags: programming atcoder contest-logs

CSES Fixed-Length Paths I
Oct 4 2024
4:10 PM

Problem statement

Actually very similar problem to IOI11p2 (Race) which I did last weekend, using centroid decomposition and then naive dp. Decided to write this one in C*, which was surprisingly easy.

...

read more

tags: programming cses

le brick
Oct 1 2024
10:54 PM

vced ARC 058 w/ jasonwei

C was theoretically easy, construct from smallest digit, etc. but I messed up overflow case [twice] and that whole mess took like 30m total

D was fun combo, pathfinding nonsense that partition & track crossings kind of deleted

E was some DP that I failed, also managed to forget that complementary counting existed.. smh

didn't have anything substantial on F besides "knapsack" so ya

mid contest, definitely need to work on dp

tags: programming atcoder contest-logs

2011 IOI
Oct 1 2024
4:43 PM

Easier contest (by nature of its age) but still pretty fun. Due to schedule I started around 3 pm and therefore ended at 8, on both days, so didn't have much time to writeup each day separately.

...

read more

tags: programming ioi contest-logs

Atcoder Beginner Contest 373
Sep 28 2024
10:35 AM
  • A: trivial

  • B: invert array, trivial

  • C: trivial

  • D: pretty cool, restructure directed graph as an undirected graph w/ directed weight, DFS

  • E: possibly some sort of ranging and binary search, couldn't work out implementation

  • F: tried to run the knapsack dp as normal but store a best_cost[] alongside, and attempted to use some quasi-convexity and 2p to speed up choice but this did not work (AC x53, WA x5)

  • G: impossible wtf jasonwei orz

terrible perf lol. should I take the upcoming AGC? idk.

tags: programming atcoder contest-logs

sleep is actually so important
Sep 27 2024
6:56 PM

I've been sleeping kind of late recently and it is really interesting to see how it has been affecting my productivity. Particularly I noticed that I physically have lower energy, even many hours after I wake up, and that my focus is worse, procrastination, etc. I really didn't realize that lack of sleep could have so much of an effect on a person.. good to know!

The Life Cycle of a Community
Sep 20 2024
11:16 PM

The average small friend-group discord server starts simple, starts close-knit. And time passes, friends of friends join, eventually forming a distinction between the 'old' and the 'new'. More time passes, and the climate slowly changes; no longer quite so close-knit. Then inevitably, one of the first original members leaves. And this is in most cases the beginning of the end, a change that can only be delayed, not reversed.

As more members leave, the server drifts farther away from the vision it was set out to be, and more and more of the core members go inactive or leave entirely. Once this reaches critical mass, the server either burns out or overturns its members, its focus, its goal.

This is a pattern I've seen countless times in online communities. Much like any other social space, they are in a continual, inevitable state of change, in cycles where they are born, mature, grow old, and eventually die.

But though the same sort of patterns happen across nearly all social circles, every cycle's start is unique, its middle-age plays out unlike any before, and ends in its own way, too. So perhaps such a pattern isn't about the rigidity of social norm, but a meta-pattern in human behavior itself, and the way we respond and adapt to changes in ourselves, those around us, in the way we all interconnect; Seeing that larger, more physically-based communities still experience these same effects but over a longer timescale, what does this imply about the world we live in today?

tags: life

2014 IOI day 2
Sep 19 2024
11:39 AM

Took the contest 2 days ago but was pretty busy yesterday (with some discrete math project skull) so doing writeup rn in school lmao

...

read more

tags: programming ioi contest-logs

2014 IOI day 1
Sep 17 2024
9:27 AM

Virtualed IOI14d1 yesterday. Due to time (18:30 - 23:30) I didn't feel like writing up last night, so I'm just doing this while bored at school :p

...

read more

tags: programming ioi contest-logs

Little updates
Sep 15 2024
10:54 PM

Weekend was pretty great. Took the atcoder on Saturday, was pretty nice. Had to sort out a bunch of stuff for most of the rest of the day, cant say here, kinda confidential. Today had ARML practice :D :D then did a pretty quick half cycle and kinda bricked on ioi18p5 :skull: oops

Atcoder breakdown...

read more

"When wil calc BC ever be useful to me?"
Sep 11 2024
7:57 PM

Today, I was working on some 3d matrix projection stuff for some simulation, and needed a simple sin() approximation. Because I was writing this in a non-compileime CBAS segment, I didn't have access to <math.h>, and was too lazy to add builtin trig functions. That's when I remembered: calc has a pretty simple way to approximate complicated functions with polynomials!

Even better, I didn't need an approximation that would work over all input values of theta - only between -pi/2 and pi/2, so a taylor series to three terms did the trick:

...

read more

tags: programming math

Is lack of memorability memorable
Sep 10 2024
11:18 PM

Hey guys. Not a lot has happened recently, so I haven't been posting a lot. I might try out semi-regular casual posts similar to what jasonwei does. Not sure.

School has been going fine so far. Workload is actually kinda suspiciously low, but it's probably going to increase a lot once lang and physics ramp up.. Clubs and stuff are starting around now, but I kinda don't have the time or energy to be that involved in many (and contest club is out of question due to not enough ppl) nor do really any of them particularly interest me tbh.

Some classes are kinda free rn so I can get away with coding...

read more

tags: school

Atcoder Beginner Contest 370 (and weird binary search?)
Sep 7 2024
10:48 AM

Decent contest. Started 6 min late bc I lost track of time while debugging some cses problem :/ but it was fine..

ABC were basically trivial, C had a pretty simple pattern (provable by optimal-choice argument) which I got relatively quickly. D was an adventure, though.

Task essentially asks us to determine in a 2d bitfield the...

read more

tags: programming atcoder contest-logs

alleged cses grind
Sep 2 2024
6:00 PM

@ the halfway point
it only gets harder...

read more

tags: programming cses

d1 fumbler (me)
Aug 31 2024
11:39 AM

I did the ABC today: https://atcoder.jp/contests/abc369

The fumbling started on problem A, where I misread the input format and consequently got 2 WA (don't worry why this caused 2 WA and not 1). Then I did a dumb thing...

read more

tags: programming atcoder contest-logs

Summer ends
Aug 25 2024
5:28 PM

Life isn't a zero-sum game.
So stop using grundy theory.

- unnamed  


Junior year begins tomorrow!

Classes

  • Discrete Math :D
  • AP Physics C (one of the last APs my school offers.. lol)
  • Machine Learning
  • Biology
  • Chinese 5
  • The Art of Persuasion (AP Lit but with a diff name bc school weird)

I somehow ended up with 50% course overlap with two of my close friends - will be interesting for sure. Also my school gives an obscene amount of free time so I probably can get away with upsolving atcoders or something like that because imagine socializing.

tags: school

implementation implementation implementation
Aug 24 2024
12:28 AM

I finally stopped procrastinating on upsolving IOI18 day 1 p2 today.. lol

The implementation of this problem was some 2d grid swap updates that update a segtree... overall just a massive pain to deal with


I started writing up (for specifically subtask 5, which enforced that the grid was a line) my solution this morning, building off of the stuff I had from the virtual. Then I kinda got distracted with some cses problems and...

read more

tags: programming ioi

Should I use normal binlift
Aug 22 2024
8:42 PM

Up until about now I've been using the binlift from this cf blog, which is linear in space and build complexity, but has a higher constant factor. This has really never been useful to me, and it's a little more complicated to write, too..

tags: programming codeforces

2018 IOI day 1
Aug 20 2024
12:04 AM

Completed the second half of IOI18. Performance was kinda eh, but wasn't expecting much :clown:


0:00 - 1:30

Solved Combo. Essentially the construction I found was to guess the next 2 bits in the sequence over the course of two queries: there were 3^2 = 9 possible arrangements of next bits, and each query had three possible return values, which worked out to a...

read more

tags: programming ioi contest-logs

A Post of Recognition
Aug 19 2024
12:06 PM

Here's to the ones who dream,
foolish as they may seem...


- "Audition", La La Land  


Wow, school is starting soon!

Last year at the start of the school year I made a promise to stop procrastinating. It didn't hold. The year before that I did the same. It also didn't hold. I am again making a promise to stop procrastinating, so surely by induction, it won't hold...

read more

tags: life

Getting trolled by subtasks (again)
Aug 18 2024
10:48 PM

I was attempting some afternoon funsies for most of today, which I basically totally bricked.

Here is a hopefully not too scuffed breakdown. (would say it has spoilers, but I barely solved any of the actually interesting problems so nah)

...

read more

tags: programming ioi contest-logs

Sqrt Exponentiation
Aug 17 2024
1:17 PM

While helping out a friend on some CSES exponentiation problem, I came up with this humorous way to compute fast exponentiate:

So you see, the standard way to go about this sort of problem is to use binary exponentiation. But sometimes when there is a log based solution, there is a somewhat similar sqrt solution.

...

read more

tags: programming

Activation energy
Aug 14 2024
2:03 PM

Hey yall. Been a while :P

My schedule has been kinda strange ever since coming back from road trip - firstly I started a project with some friends over that trip, SARA, which took up a decent portion of my first few days back. Then I had to deal with some school related stuff, and got involved with a new project after that... and all in all I haven't had had as much time to work on contest recently, or update this blog.

Finally decided to allocate a block of time to updating blog, so here we are! (hence the title)

Also, now that most of the projects I've been working on are at reasonably complete stages, I can talk a bit about them here! This is a short overview of what I've been up to recently:

...

read more

tags: programming life

Cyclical Ramblings
Aug 1 2024
1:25 AM

Over the course of the past week, I've had a lot of ideas come through my head that I haven't been able to incorporate into blog posts of their own. I'll try to put them out here, and hopefully some meaning can be derived from my ramblings...

read more

tags: life

On the road
Jul 25 2024
1:30 PM

Going to be driving a circuit across northeast America, starting west to Ohio, then north through Toronto, Montreal, etc, then back down through New York. Will take about 10 days :D

Might not be able to update blog as often, but will continue contest programming grind :pray:

Square Root Decomposition is underrated
Jul 24 2024
9:01 PM

Finished up ccc '17 s5, which I failed to get in yesterday's practice contest. Ended up using sqrt bucketing, which I've never used before.

...

read more

tags: programming ccc

CSS-only image expansion on click
Jul 24 2024
10:54 AM

Completely JS free...

read more

tags: programming

Binlifting <3
Jul 23 2024
10:13 PM

I very recently finished this USACO gold question, and my friend was interested in my (mildly scuffed) binary lifting approach. Here it is, I guess :P

...

read more

tags: programming usaco

CCC 2017 Senior Division
Jul 23 2024
2:41 PM

Simulated this contest today - here are my notes and solutions!

...

read more

tags: programming ccc contest-logs

CCC 2018 Senior Division
Jul 22 2024
8:23 PM

Not much, just my solutions and some comments from my practice contest today :)

Spoiler warning - contains full solutions!

...

read more

tags: programming ccc contest-logs

No more manual code formatting!
Jul 22 2024
12:59 PM

For c-like languages, that is :P

Anyway, I got tired of adding in hundreds of <span> elements anytime I wanted to put up pretty code on my posts, so I wrote this script. It works pretty well!

Example formatting of one of my various half-finished CSES solutions:

...

read more

tags: starship-dev programming

It's always one step forward, then ten more
Jul 21 2024
7:52 PM

I've been having trouble falling asleep recently.

No, it isn't anything physical - I'm not sick, and my sleep schedule isn't quite erratic enough to be the cause. What keeps me up at night is the future.

...

read more

tags: life

The m in logn stands for magic
Jul 19 2024
10:22 PM

I swear binary exponentiation on matrices is actually magic.

While explaining this CSES problem to a friend, it occured to me that I could improve my O(n) solution, which used state machine DP, into a O(log n) one, by using matrix exp.

But even though I've used it quite a few times before, it still feels like magic. Take this task for example:

...

read more

tags: programming cses math

Bad CF Practices, part 2
Jul 19 2024
11:43 AM

Today I was working through another simulated CCC contest and noticed how codeforces/speedforces has shaped my problem triage process - as CF doesn't award partials, my brain has gotten used to this decision tree:

...

read more

tags: programming codeforces

Bad CF Practices
Jul 18 2024
12:06 PM

So today I was working on this problem on DMOJ.

First, some observations:

  • We're dealing with a tree of max size 2e5
  • Result is the count of some type of paths
  • DP contained-subtree etc etc

Constraint analysis: Result is bounded by something on the order of 4e10, higher than the 32-bit limit.

This is where my bad CF habits kick in...

read more

tags: programming codeforces

Entropy
Jul 16 2024
11:42 PM

I've been doing a lot of thinking recently about the flow of time.

The summer days are kind of blending together into a blur - a blur so reminiscent of last summer, when the days ran long and time seemed to stand still...

read more

tags: life

A rigid-body 2d physics engine!
Jul 8 2024
9:03 PM

Continuation of this post


Previously, we created a basic particle-based physics engine. Each point was stored as simply a position and velocity, and iterated to produce natural-looking motion.

How can we extend this to more complex shapes?

Before we even try to simulate such shapes, we'll need a way to store them. A simple point can be represented fully with a position and velocity, as...

read more

tags: programming

a poe
Jul 7 2024
3:06 PM

this would be a poem
but I am too lazy
too lazy to -


The beginnings of a 2d physics engine
Jul 7 2024
1:40 PM

In this blog post, we'll be covering the basics of how iteration-based physics works,and then implementing a very simple proto-engine in C.


Let's start with some background on iterative simulations as a whole.

Essentially all computer animations are done iteratively. Computer displays have a finite...

read more

tags: programming

On multidimensional tic-tac-toe
Jul 5 2024
1:26 PM

I was shown this puzzle by @hy3na_xyz, a member of the Rutgers competitive programming discord server. Credit goes to them!

Given an N-dimensional tic-tac-toe board of side length L, how many winning paths are there? A winning path is a sequence of L cells that follow a linear path through the N-dimensional hypercube of the game board. ...

read more

tags: math

rebuild.py! And, Starship v1.3.2 release
Jul 4 2024
11:55 AM

So I decided to reformat artifacts as they are currently so that rebuilding is possible. The system works really well - but not only that: I'll be able to merge my old blog posts into mainstream without issues!

...

read more

tags: starship-dev

Ah, the limits of a static site...
Jul 4 2024
1:20 AM

I'm quickly realizing how useful the ability to edit/delete previous pages is..

Not even just editing previous posts, but making layout changes comes with an inconvenience factor which scales O(n) with...

read more

tags: starship-dev

More users! :D
Jul 3 2024
11:19 PM

My little sister's blog now uses Starship. Its styling looks really nice!

Also, while helping her set it up, we found a bug in the link generator code for standalone pages :P

Hello from Starship v1.3
Jul 3 2024
2:17 PM

The old blog has been nuked due to major breaking changes between v1.2 and v1.3 backend. Most pages are now...

read more

tags: starship-dev