summaryrefslogtreecommitdiff
path: root/kattis-kth-alginda-quicksort/src/main.rs
blob: 67646b3c87681ea12547fba7113ccfe79811e4bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// https://kth.kattis.com/problems/kth.alginda.quicksort

#![feature(test)]

use std::fmt::Write;
use std::io::{stdin, Read};

mod radix_sort;

use radix_sort::radix_sort;

fn main() {
    let mut buffer = String::new();
    stdin().lock().read_to_string(&mut buffer).unwrap();
    let xs: Vec<i32> = buffer
        .split_ascii_whitespace()
        .skip(1)
        .map(|x| x.parse().unwrap())
        .collect();

    let xs = radix_sort(xs);

    buffer.clear();
    for x in xs {
        writeln!(buffer, "{}", x).unwrap();
    }
    print!("{}", buffer);
}