| Task | #16 |
|---|---|
| Position | 1 |
| Score | 169,520 |
| Best Score | 169,520 |
| Points | 1.000 |
Problem Statement
You have a data stream of uint32 numbers in binary representation sending to STDIN. The byte order is little endian.
For each number n print:
FizzBuzzifnis divisible by 3 and 5.Fizzifnis divisible by 3.Buzzifnis divisible by 5.n(as a string) if none of the above conditions are true.
Numbers quantity is 30 000 000.
Input Generator
Random Bytes (confirmed with distcheck)
Solution Sketch
For FizzBuzz, Fizz, Buzz cases just do a memcpy.
For the other cases, use a big Constexpr LUT for going from int→string. Do a divmod with 1e5, then index into a low LUT and a high LUT. Combine, print and advance the output pointer.
Thoughts
I think this could be more competitive with some pipelining and vectorized division. Hadn’t gotten around to trying it. Maybe those who do format ints really fast can do the same here.
A complicated SIMD kernel I had made to do this in pairs ended up being slower.