20240819


“When life gives you lemons, make lemonade” is my friend's favorite proverbial phrase.

At first glance, I thought the proverb meant “bloom where God has planted you,” but I was wrong.

The proberb means you are responsible for making your life cheerful, and lemons here are a metaphor for life’s challenges.


I had a chance to talk with a software engineer at Amazon, and he said that engineers there work at least 60 hours a week.

It would be a great opportunity to grow if I was a fresher who had just graduated from college, but I got old (to some extent) and had no energy left in me to burn.


I need to wake up early tomorrow. It's daunting… though my circadian rhythm is almost repaired.


1971E. Find the Car

Wow, I managed to solve the problem without references.

  1. find the section d belongs to
  2. calculate the offset
def find_section(k: int, a: list[int], d: int) -> int:
    # binary search
    li: int = 0
    ri: int = k
    while li < ri - 1:
        mi: int = (li + ri) // 2
        if a[mi] == d:
            return mi
        elif a[mi] < d:
            li = mi
        else:
            ri = mi
    return li


for tc in range(int(input())):
    n, k, q = map(int, input().split())
    a: list[int] = [0] + list(map(int, input().split()))
    b: list[int] = [0] + list(map(int, input().split()))

    ans: list[int] = []
    for qc in range(q):
        d: int = int(input())
        i: int = find_section(k, a, d)

        if a[i] == d:
            ans.append(b[i])
            continue

        _ans: int = b[i] + (d - a[i]) * (b[i + 1] - b[i]) // (a[i + 1] - a[i])
        ans.append(_ans)

    print(" ".join([str(x) for x in ans]))

Salad 400 Rice 400 Smoothie 300 Protein bar 200 Yogurt 300

Total 1600 kcal

6k run, push-ups


MUST:

TODO:


index 20240818 20240820