pilliamw's blog

By pilliamw, history, 6 months ago, In English

In light of recent events and general trends in competitive programming over the last few years, it's become increasingly clear (and frustrating) to me about how ineffective the current rules page in Codeforces is.

Here's a challenge for you — using only the Codeforces platform (no Google/search engines), try to find the answers in-text to the following five questions:

  • What's an "open hacking phase", and why do hacks sometimes give points but sometimes not?
  • If you resubmit a solution that passed pretests due to a bug you found, which submission time is used?
  • What online resources are you allowed to use? Language documentation? StackOverflow excerpts?
  • What are the punishments for cheating?
  • What kinds of blog posts are appropriate on the platform?

See the issue here? One could argue that people could easily search up and find the answers to some of these questions on external websites or unofficial blog posts, but consider this: when was the last time you visited a website that didn't have a clearly outlined "Rules" section accessible in one (perhaps a maximum of two) clicks from the home page? Moreover, what's with all the rules being split across five different blog posts? I couldn't even find an official source to answer the fourth and fifth questions (does Mike flip a coin between banning a user and just skipping them whenever he finds a cheater? Who knows, it's not officially listed anywhere I could find.) Even the USACO website, which has a UI that probably hasn't been changed since the 2000s, has a sufficiently comprehensive rules page that can be accessed in the relatively simple "Details/FAQ -> CTRL-F for 'rules' link" pathway. And get this — it's all listed in one HTML page! Truly revolutionary technology, am I right?

The point of all this is, why doesn't Codeforces have an easy-to-read, official rules documentation for any question a new user could ask? Regardless of your stance on the nuances of what behavior is acceptable or how moderators should deal with rule-breakers, it's ridiculous that this website doesn't have what should be a bare minimum for any competitive platform in the modern year of 2026. And I'm sure everyone will be happy that they don't have to read (or write) blog posts about Codeforces rules that should be obvious to anyone using the platform. The barrier to entry for using Codeforces shouldn't be sifting through decade-old blog posts to get a clarification on a single question you might have about the scoring system.

Please, if anyone at Codeforces HQ is reading this, just set aside a day (or week, or month, or however long it takes — as long as it covers everything and is correct) to add a neat little "RULES" tab to that navigation bar at the top, and have it link to a single page that lists everything a new user might need to know! The userbase will thank you.

Full text and comments »

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

By pilliamw, 7 months ago, In English

As a problemsetter, this is a question that I've been thinking about for a very long time — writing high-quality and challenging tasks for a contest's problemset is a valuable and much-discussed skill, but barely anyone ever talks about or even remembers the first two problems of a contest (barring Div1s, which this blog post largely doesn't apply to). This is a great shame in my eyes; Div2As always boast the highest solve counts in virtually every Div2 round, and are accessible to the widest audience of Codeforces users, but are almost never discussed in the comments section of the contest blog post or editorial.

Is this simply because such tasks are considered trivial in the eyes of most Codeforces users (at least, those rated above 1200) and therefore not worth discussing? Perhaps, but there are usually about two to four thousand people per contest who solve the Div2A and Div2B but fail to solve anything beyond that, meaning that for these people the A problem forms the majority of the contest experience — I think this is a substantial enough audience to warrant a discussion about what actually makes these so-called "easy" problems "good" versus "mediocre."

TLDR Div2As are barely ever talked about and I think they should be discussed more, which is what this blog post is for.

My Take

Disclaimer: This is just my opinion
Disclaimer 2: Educational Rounds are weird

The recent 2197A - Friendly Numbers is largely what motivated me to make this post. As an unofficial participant, I spent several minutes looking at this problem wondering if there was an easy trick with manipulating the sum of digits, before disappointingly realizing that any numbers above roughly $$$x+100$$$ simply could not be friendly, leading to a rather uninvolved brute force check. Sure, this is an easy problem (reflected by the solve count), and the skill of recognizing cutoffs and answer bounds is arguably important, but it also didn't exactly feel very fun or involved to solve. Is that a bad thing? I argue that it is.

In my eyes, a Div2A should satisfy five basic principles:

  • Easy:
Since a Div2A is the barrier to entry for Codeforces, it follows that it shouldn't be unnecessarily high as to drive off first-time competitors.
  • Implementation-Light:
There's a lot of discussion to be had on the benefits of so-called 'implementation slop' problems. Regardless of your stance, the one place an implementation-heavy problem should NOT be is the first problem in a problemset; its not fun for first-time participants and portrays a distorted picture of competitive programming as having an emphasis on raw programming translation, and it kills momentum for higher-rated participants who just want to get a move on.
A Div2A should aim to be as 'Russian' as possible.
  • Avoid "Brute Force" as main solutions:
Going hand-in-hand with the previous point, the key observation to a Div2A should ideally reduce the problem to something more satisfying than just a simple brute force with bounds.
  • Sample Tests Shouldn't Mislead:
This is probably the most controversial point here (refer to the dozens of 'WA on Pretest 2 is bad' blogs). Yet, just as with the above point on implementation, I don't think that a Div2A is a good place to put such problems.

In my opinion, Div2As that follow the majority of the above principles generally get better reception from both new and experienced competitive programmers, and thus should be the standard for the beginning problem of a contest. Of course, that's just my opinion — if you disagree with all of the points and think that Div2As should be more implementation-based, or want to see (or have seen) a high-quality bitwise Div2A in a contest someday, or think that a 1600 rated user can't possibly know what they're talking about (I won't take offense) — please let me know in the comments! I think this is a good opportunity to have a discussion on an otherwise little-discussed aspect of problemsetting.

Full text and comments »

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

By pilliamw, history, 8 months ago, In English

While scrolling through the submission pages for the recent Goodbye Round 2025, I noticed a very interesting difference in some of the submissions with "Skipped" verdicts:

Submissions that received "Skipped" due to re-submission or similar:

Submissions that received "Skipped" due to cheating (AI, plagiarism, etc.)

Apart from being a pretty humorous change during the holiday season, this feature is also pretty informative for ascertaining whether a skipped submission was legitimate or cheated. Could we see this distinction be carried over once the holidays end? Clearly, the code to implement this is already there, so the distinction of "Skipped" verdicts into perhaps "Obsolete" and "Disqualified" would be pretty informative for detecting cheaters. (Besides, in it's current state, "skipped" doesn't nearly convey the seriousness of cheating.)

Full text and comments »

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

By pilliamw, history, 8 months ago, In English

Since hacks are often either disabled or simply absent on A-D for most contests, it seems redundant to run solutions on system tests that are exactly the same as pretests. Would it be possible to simply use the pretest result during system testing for earlier problems? This would save a lot of computation time as the majority of submissions are on earlier problems.

Full text and comments »

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

By pilliamw, history, 10 months ago, In English

We've all seen the cheater callout spiel I'll just cut to the chase:

User: sevenseas

Red flags:

  • Swapping from C# to C++ in the middle of the contest (different language in F2 than F1, like ???)
  • Randomly adding and removing FastScanner (shouldn't happen if using a template)
  • Weirdly minified code
  • Previously cheating in a SCHOOL CONTEST and then deleting messages in the Discord when being called out

I honestly wouldn't have cared enough to make this post if it wasn't for that last point — it doesn't sit right with me that the random CM that I had to ban for blatant AI usage is ahead of the PHSCO winner in the most recent contest standings. Hopefully this post will bring justice and make somebody's day when rating rollbacks come around.

On an unrelated note, Mike should really add a separate forum for reporting cheaters, I feel kind of bad for adding this blog to the recent actions sidebar lol

Full text and comments »

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

By pilliamw, 10 months ago, In English

Thanks to everyone who participated in the Fall 2025 PHSCO! Over 40 teams participated across both divisions, which is a new record and extremely inspiring for our second-ever hosted contest. Things went a lot more smoothly this year and we hope that all (or at least a majority) of the problems were enjoyable. On a personal note, being able to run PHSCO is an amazing opportunity and I can't thank all of you enough for making it possible.

Anyways, without further ado, congratulations to all of the winners in each prize pool! Please check your emails for prizes, which should be sent out within this week. (If you don't receive anything after a week, please contact me!)

Standard Division (Pre-College):

  • 1st — Entropy — TheInfiniteLoop — Narayana Educational Institution
  • 2nd — 1 orz 1 norz — Eason Li, Ethan Chang (easonli416, spoonspoon1006) — Ellen Fletcher Middle School, Davidson Academy
  • 3rd — Exertxfy — Somil Varshney, Shiven Khurana (Exertxfy, BlackPearls) — Montgomery Blair High School

Advanced Division (Pre-College):

  • 1st — ecnerwala orz — Vihaan Sharma, Jason Shnaper (WorldWarV, silverkeep) — Piedmont Hills High School
  • 2nd — Why always me? — Nathan Katov, Marcus Liu (NK_, Sucram314) — Colonel By S.S, University of Toronto Schools
  • 3rd — Roman Mielamud (rrmpwn_) — Mariupol Lyceum of Kyiv City

Advanced Division (Global):

  • 1st — Necromancer — Jhao Wei Fan (SorahISA) — National Yang Ming Chiao Tung University
  • 2nd — Bar of USACO Camp — Yiming Li, Xianghong Luo (liympanda, lxhgww)
  • 3rd — ecnerwala orz — Vihaan Sharma, Jason Shnaper (WorldWarV, silverkeep) — Piedmont Hills High School

And a huge shoutout to everyone who helped prepare the contest:

  • Problems were written and prepared by me, William Park (pilliamw)
  • Standard Division was tested by Aanshi Patel (shilab) and Ben Ross (benmross)
  • Advanced Division was tested by Anna Zhou (the_808808th_user)
  • Problems were proofread by Nicole Sabova (._nicolesss_.) and Brooke Yin
  • Announcement banner was drawn by Brooke Yin
  • Prize pool sponsored by the Poolesville HS Science, Math, and Computer Science magnet program

Below are editorials to each problem across all divisions, roughly ordered by difficulty. If you liked/disliked a specific problem, please leave feedback using the "Rate the problem" widget! Anyone can access and submit to problems via the public group link.

We hope to see you again for the Spring Fall 2026 PHSCO. Onwards and upwards! — William Park


General Feedback

How was the overall contest?
How was the difficulty distribution (Standard Division)?
How was the difficulty distribution (Advanced Division)?
In future contests, should the leaderboard be frozen in the final hour?

Std. A — Entry Tickets

Solution
Code
Rate the Problem

Std. B — Candy Bowl

Solution
Code
Rate the Problem

Std. C — Hepta Hex

Solution
Code
Rate the Problem

Adv. A — Candy Collection

Solution
Code
Rate the Problem

Std. E — Potluck

Solution
Code
Rate the Problem

Adv. B — A Tale of Silk & Song

Solution
Code
Rate the Problem

Std. G — Trick-Or-Treat Lane (Standard Div.)

Solution
Code
Rate the Problem

Adv. C — Spiderweb

Solution
Code
Rate the Problem

Adv. D — Bonfire

Hint 1
Hint 2
Hint 3
Solution
Code
Rate the Problem

Adv. E — Bewitching Bitwise Game

Hint 1
Hint 2
Hint 3
Solution
Code
Rate the Problem

Adv. F — Path Planning

Hint 1
Hint 2
Solution
Code
Rate the Problem

Adv. G — Soulbound Spins

Hint 1
Hint 2
Solution
Code
Rate the Problem

Adv. H — The Mist (Easy Version)

Hint 1
Hint 2
Hint 3
Solution
Alternate Solution
Code (First Solution)
Rate the Problem

Adv. I — Grid Coverage

Hint 1
Hint 2
Solution
Code
Rate the Problem

Adv. J — The Great Ghost Duel

A more in-depth tutorial for this problem will be written soon.

Hint 1
Hint 2
Hint 3
Solution
Code
Rate the Problem

Adv. K — The Mist (Hard Version)

A more in-depth tutorial for this problem will be written soon.

Hint 1
Hint 2
Solution
Code
Rate the Problem

Adv. L — Trick-or-Treat Lane (Advanced Division)

A more in-depth tutorial for this problem will be written soon.

Hint 1
Hint 2
Hint 3
Hint 4
Hint 5
Hint 6
Solution
Code
Rate the Problem

Full text and comments »

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

By pilliamw, history, 10 months ago, In English

Hi Codeforces! I'm excited to invite you to the Fall 2025 PHS Computing Olympiad, a programming contest run by the Poolesville High School computer team! The contest will take place on October 25th, 2025 at 5:00PM (UTC) and last for four hours.

Format & Difficulty

The contest will be hosted on Codeforces and last for 4 hours. There will be a Standard Division and an Advanced Division, roughly corresponding to Div4 and Div2 difficulty, respectively. Each division will contain $$$12$$$ to $$$15$$$ problems, and all problems are equally weighted with a time penalty of 20 minutes for wrong submission.

You can choose to register either as a solo participant or as a team of two.

This contest is aimed towards participants with $$$ \lt 2100$$$ rating, but anyone is welcome to participate!

Prizes

Prizes will be given to the top-performing high school teams in each division, as well as to the top-performing global participants in the Advanced Division.

  • Standard Podium (HS or below): $40, $30, $20
  • Advanced Podium (HS or below): $60, $40, $30
  • Advanced Podium (All Participants): $25, $15, $10

If participating as a team of two, prize money will be evenly split between both members.

A big shoutout to the PHS Science, Math, and Computer Science program for sponsoring the prize pool for this year's PHSCO!

Registration

To register, please fill out this form and join the Codeforces group prior to the competition date!

For more information, visit our website at https://www.phsco.info.

UPD: Editorial & Winners

Full text and comments »

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

By pilliamw, history, 11 months ago, In English

I'm planning to host a school contest on the 25th of October, and I'd obviously like to avoid any conflicts with rated contests. Is it safe to assume that there won't be a Codeforces round scheduled for that date (seeing as one for the 26th is already scheduled?)

Full text and comments »

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

By pilliamw, history, 11 months ago, In English

Everyone on this platform and their mother probably knows about the issue of AI being used to cheat during contests. What I see much less often is how AI is affecting the Codeforces community itself. Why do posts like https://codeforces.me/blog/entry/146698 earn +60 upvotes for a prompt that probably took 5 minutes to throw into ChatGPT? What happened to drawing out thoughtful diagrams and maybe adding a couple easter eggs into the art instead of asking AI to generate art for a problem statement (2127D - Root was Built by Love, Broken by Destiny, 2034C - Trapped in the Witch's Labyrinth) and calling it a day?

Of course, it's unfortunately time-efficient and cost-effective to send a prompt to GPT instead of drawing something out yourself (or get this — commissioning an actual artist), but it seems rather hypocritical that half the community calls out for the banishment of AI from contests but turns a blind eye to its effect on the creative side. It's especially frustrating to get my friends and classmates (many of whom are artists) to join the Codeforces scene when the very first featured blog post has an AI-generated promotional image (not now, but a while back). Am I the only one who thinks this way?

Full text and comments »

Tags ai
  • Vote: I like it
  • +177
  • Vote: I do not like it

By pilliamw, history, 13 months ago, In English

In today's contest, I found the algorithm to B relatively quickly... and then proceeded to get about 5 WAs due to off-by-one implementation errors :skull:

Are there any tips you guys use to avoid silly off-by-one errors with indices? IDK why but something about it just doesn't click for me in-contest. (Surely I'm not the only one with this issue...)

Full text and comments »

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

By pilliamw, history, 13 months ago, In English

90% of Python solutions to A will get hacked or fail systests, since using the obvious ans += s[i] in a loop or similar will immediately balloon into O(n^2). My question is, why would one even need to consider this for a Div2A? It's not like it even adds to the complexity of the problem — the difficulty and algorithm would be the same for $$$|s| \lt 10^3$$$ or something. At the very least, have a pretest that's the trivial print(1) print('A'*200000) generator I wrote in 30 seconds, instead of leaving that to the hacking phase.

(To be fair, I'm pretty salty right now because I dropped from 2000 to 8000 after hacking my A. But I still think this is a pretty serious problem, especially for an educational round where problems have equal weighting... unless the goal was to educate me to not use Python ever again :/)

Update: Yep, I know that Python string concatenation is rather expensive now, you don't have to keep commenting that (although I appreciate everyone who responded :D). I guess the Educational Round succeeded in being educational! I still think that there should have been a strict $$$2*10^5$$$ pretest, but whatever, I'll take the L here. Now time to get back to Expert...

Full text and comments »

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

By pilliamw, history, 19 months ago, In English

Hi, is it possible to add point distributions to a mashup contest?

For example, in official contests, scoring often works by assigning 500 pts to A, 1000 pts to B, etc. I want to replicate this in a mashup contest.

(What my mashup currently looks like)

(What I want to replicate)

Full text and comments »

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