23 June 2020

Codeforces Round #652 (Div. 2) Postmortem

What went well
  • 0:00 submission for A!
  • Got ABCD (albeit slowly).
What went poorly
  • Incurred one wrong answer for B and C each (and took a long time too).
  • Took half an hour to recognize the recursion for the tree structure in D.
  • Thought that the residues of numbers compare the same way as the the numbers themselves (i.e. a > b implies (a % m) > (b % m)…no, just no).
Where I got lucky
  • Got D with 9 minutes to go, which involved a slight wild guess.

21 June 2020

Codeforces Round #651 (Div. 2) Postmortem

What went well
  • Decently fast ABC (0:01, 0:10, 0:23).
What went wrong
  • Walled by D. I didn't recognize that binary search works because I didn't know how to verify that a subsequence with max less than or equal to a target value was doable in O(N).
  • I thought incorrectly (yet again) that O(N lg N) is too slow for N <= 10**6, so I tried something silly to find the minimum # subsequences of the form (01)+ or (10)+, when a straightforward O(N lg N) would have worked.
Where I got lucky
  • Gained rating!

13 June 2020

Bugforces (ft. senile logarithmic exponentiation)

Sad things happen when you lose your mind:
using i64 = long long;

// Precondition: (base, exponent) won't cause overflow
i64
my_pow(const i64 base, const i64 exponent)
{
  i64 accumulator = 0;
  for (i64 exponent2 = exponent, current_power = base; exponent2 > 0;
      exponent2 >>= 1, current_pow *= current_pow)
  {
    if (exponent2 & 1)
    {
      accumulator += current_power;
    }
  }
  return accumulator;
}

04 June 2020

Codeforces Round #647 (Div. 2) Postmortem

What went well
  • Got B in 5 minutes -- straightforward problem.
  • Got C in 5 minutes -- another straightforward problem.
  • Got D in 20 minutes, once I figured out how to read. :-P
  • New personal best!!!
What went poorly
  • Wrote an extremely clumsy solution for A because I decided after a brief tradeoff analysis to match the problem statement as close as possible instead of thinking about a better implementation
  • IlliterateForces strikes again -- misread D, so submitted a solution that solves a similar problem, which cost ~20min and a submission penalty.
  • Couldn't get E.
Where I got lucky
  • Got extremely lucky with B and C. I have been struggling with Bs recently; this B's 5 minute solve time thankfully bucks the trend. My previous fastest C solve time was ~15 minutes.

26 April 2020

Bugforces (ft Education Codeforces Round 86)

Consider the following implementation to find the smallest multiple of x at least as big as y:

typedef long long i64;

i64
next_mult_ge(const i64 y, const i64 x)
{
    return ceil(y / (double) x) * x;
}

What can go wrong?

Educational Codeforces Round 86 Postmortem

What went well
  • Sampling other submissions, my solution to C is cleaner and more intuitive (if only it worked!!!)
What went poorly
  • A took a long time
  • My C implementation died to nuances of ceil(); I wanted to find the multiple of a number at least as large as some threshold.
Where I got lucky
  • I was able to use fast-slow testing to determine a test case that breaks my C.

25 April 2020

TopCoder SRM 784 Postmortem

What went well
  • I was able to solve Div2C/Div1A.
  • I was able to fix a bug in my implementation for C.
What went poorly
  • Got A wrong because I couldn't understand the problem.
  • I realized the bug in my C after submitting my code, so the resubmission incurred a significant (200pt) penalty).
Where I got lucky
  •  Div2C/Div1A seemed a lot easier than usual.

14 April 2020

Codeforces Round #635 (Div. 2) Postmortem

What went well
  • A was trivial.
  • B was easy.
  • I didn't feel stuck when attempting D.
What went poorly
  • C took a long time because I didn't realize that I had to consider two criteria for the greedy solution (first Wrong Answer). Then I didn't realize that the two criteria were not mutually exclusive (second Wrong Answer). All said and done, I spent 1h30.
Where I got lucky
  • Somehow still above 1700!

06 April 2020

CA-1 Drive: Short Version

Start: CA-1 exit off US-101
First choice: CA-1 (orange) or Panoramic Drive (red)
Second choice: Petaluma (blue) or Santa Rosa (green)
  • There's a great restaurant in Santa Rosa called "Naked Pig." They serve the lightest waffles with optional bacon bits embedded.
Return: US-101 South

03 March 2020

Codeforces Ozon Tech Challenge (Div. 1 + Div. 2) Postmortem

What went well
  • C was a silly number theory problem, which I got in ~10 minutes. This might be my fastest C solve yet.
What went wrong
  • I was unable to debug my solution to D in ~2 hours. I initially started pursuing an idea which involved querying vertices from pairs of vertices, but then I wasn't sure which two of the (up to) four vertices I should query. Then I noticed that I can just "trim the tree" by querying two leaves at once and pruning the tree if the LCA were neither leaves queried. However, I overcomplicated my solution by removing the vertices in the path from the leaf to the LCA, so I'm sure the bug is somewhere in there.
  • I wasn't sure how to prove B, which took me 20 minutes to solve.
Where I got lucky
  • I gained elo so my rating is back above 1700. Yay!