jo_on's blog

By jo_on, history, 17 months ago, In English

Hi Codeforces!

Two years ago, I posted a blog about cp-badges, a simple competitive programming badge I made for fun. To the best of my knowledge, it was the first GitHub badge ever for competitive programmers!

However, it was only my personal toy project, and the server was running on a machine of the algorithm club in my college, which was unstable and unreliable. Here is what happened: since the club homepage moved to GitHub pages, few people cared about club's machine, and after the machine was turned off due to some power maintenance, it was gone forever. I was also busy applying for graduate school, didn't do any competitive programming, so I forgot about this toy project as well.

A few years later, I got some spare time, so I started some programming (including CP) again. Then I noticed that some people actually tried to use this badge!

So I decided, still for fun, to revive cp-badges. I rewrote the code and setup a server on my reliable cloud platform. I realized that so many things have changed — Python 3.11 came out, some packages had major version updates, my favorite Python dependency management tool Poetry's GitHub stars came close to the old Pipenv's, and so on.

To get to the point, here are the new URLs for competitive programming badges:

https://badges.joonhyung.xyz/codeforces/jo_on.svg

https://badges.joonhyung.xyz/topcoder/kuratowski.svg

https://badges.joonhyung.xyz/atcoder/topology.svg

CF TC AC

Only these three platforms are supported, though I am considering adding more platforms in the future as long as I have access to official APIs (I personally dislike web scraping).

In Markdown (e.g. if you want to use them in GitHub profile), you can do the following:

[![Codeforces](https://badges.joonhyung.xyz/codeforces/jo_on.svg)](https://codeforces.com/profile/jo_on)

I also added some customizability. For instance, if you think the AtCoder logo is too dark, you can use another one or choose a different color:

https://badges.joonhyung.xyz/atcoder/tourist.svg?logo=https://img.atcoder.jp/assets/logo.png

https://badges.joonhyung.xyz/atcoder/tourist.svg?left_color=lightgray

AC AC

Feel free to use them on you GitHub profile or elsewhere!

In case you're interested, the code is on my GitHub. Any feedback or contributions are very much welcome, though I may not have enough bandwidth to respond. (After all, my job is not a programmer!)

P.S. Meanwhile, I found some other projects that do similar things:

  • CP-Badges. This is built on Vercel and is a bit slower, but supports more platforms like Yukicoder and Leetcode.
  • cf-stats. This is more about 'statistics visualization' something like this, but I also found it interesting.

Full text and comments »

  • Vote: I like it
  • +111
  • Vote: I do not like it

By jo_on, history, 4 years ago, In English

Spoiler alert: This post contains a solution to the problem.

Problem Yeetzhee of Google Kickstart 2020 Round F

Recently, a friend who participated in this round asked me to explain the solution of this problem. So I tried and managed to come up with a solution. It is nearly identical to the official analysis. It goes something like this.

My solution

I implemented this solution and got AC. But while I was explaining this solution to him, I realized that my submitted code sorted the configurations in descending order! I re-submitted the code after fixing it to ascending order. Of course got AC too.

This led me to think that the following strategy may always work: re-roll the die if and only if it is impossible to reach the final goal.

I implemented this solution and submitted. Guess what? Another AC!

My implementation

As a math student, I want to prove that such strategy is always optimal, or the test cases are weak (which seems less probable). The official analysis does not mention this incident at all. Any idea how to prove?

Full text and comments »

  • Vote: I like it
  • +37
  • Vote: I do not like it

By jo_on, history, 4 years ago, In English

Hi Codeforces!

What if there are badges on Github profile that show our Codeforces ratings?

Recently, GitHub introduced a new feature in GitHub profile. In short, if you create a special repository with a name same with your GitHub username, its README.md file will appear on your main page, just like this.

While I was thinking about what to write in my profile, I thought it would be great if there is a way to put badges that show my ratings of competitive programming platforms such as Codeforces, TopCoder, and AtCoder. I first googled to find out if there is already someone who created such badges, but I couldn't. (Perhaps because I am a bad googler...)

So I decided to make my own! Fortunately, Shields.io offers great features to customize your badges. I used Shields.io functionality together with CF, TC, AC APIs to build a very simple server that serves badge images. It works like this:

https://run.kaist.ac.kr/badges/codeforces/jo_on.svg

https://run.kaist.ac.kr/badges/topcoder/kuratowski.svg

https://run.kaist.ac.kr/badges/atcoder/topology.svg

CF TC AC

How do they look like? Despite being the most basic design of Shields.io, they look pretty neat, don't they?

Currently, I'm using these badges in my GitHub profile. However, the server is not reliable since it depends on the health of the physical machine it is running on; it is very old and slow, and under certain circumstances, we (server admins) even have to turn off the machine for a while. So I'm hoping that one day someone will build a reliable competitive programming badge server with better badge designs.

Or are there already this kind of badges somewhere but simply I cannot find them? If you know any, please share!

Full text and comments »

  • Vote: I like it
  • +268
  • Vote: I do not like it