Median Sergey Svistunov

Find the median of a stream of binary integers as fast as possible.

Input: 100 000 000 uint32 values in little-endian binary on STDIN (4 bytes each).

Output: The median value, printed as a decimal string. The median is defined as the element at index N/2 (i.e., a[50000000]) in the sorted array.

Back to listNov 27, 2022 15:00Vlad ShcherbinaVlad ShcherbinaError
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 27, 2022 15:0000000Error: Exit with code 101: 4101580 mmap [main.rs:11] approx_median = 2147312104 [main.rs:25] left_cnt = 50538004 [main.rs:26] right_cnt = 48975730 [main.rs:27] xs.len() = 486266 thread 'main' panicked at 'partition_at_index index 18446744073709013612 ...stderr