Solved 1610C โ Keshi Is Throwing a Party ๐
โ Mistake: I was only checking the mid-th friendโs (a,b)
โ Fix: I now iterate from poorest to richest, counting valid friends โ if count reaches k, itโs possible.
Binary Search + Greedy finally clicked โ got AC ๐ช๐ฅ
#whatididtoday
โ Solved CSES Array Division ๐ฅ
๐ง Key Learnings:
Debugged with while (l <= h) โ fixed off-by-1 bug (ans was 1000, my O/P was 1001 ๐ )
Realized we need subparts โค k (not == k) when checking if x can be the max subarr sum
Code: ๐https://t.co/SRoIKoJTZd
today i solved Lc 780 and
atcoder โข abc241_d - Sequence Query-map val with idx
โข cses_1161 - Stick Divisions - join like huffman
"LC 780 โ instead of subtracting many times, just do tx %= ty / ty %= tx; % compresses n subtractions into one shot โก"
Todayโs progress ๐
โ Solved 2 Qs:
1๏ธโฃ CSES: Multiplication Table โ BS on range [1, nยฒ], check mid via count โค mid vs n(n+1)/2.
2๏ธโฃ CF C. Chat Ban: BS on [1, 2kโ1], calc total emotes in m its like prefix sum or sum of first m natural nums , adjust low/high.