結果

問題 No.1471 Sort Queries
ユーザー Masaki KitaguchiMasaki Kitaguchi
提出日時 2022-02-02 22:34:18
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 1,065 bytes
コンパイル時間 2,113 ms
コンパイル使用メモリ 145,324 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 03:00:17
合計ジャッジ時間 15,096 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 136 ms
4,384 KB
testcase_14 AC 112 ms
4,380 KB
testcase_15 AC 214 ms
4,376 KB
testcase_16 AC 35 ms
4,380 KB
testcase_17 AC 94 ms
4,380 KB
testcase_18 AC 60 ms
4,376 KB
testcase_19 AC 49 ms
4,380 KB
testcase_20 AC 221 ms
4,376 KB
testcase_21 AC 101 ms
4,376 KB
testcase_22 AC 79 ms
4,380 KB
testcase_23 AC 518 ms
4,376 KB
testcase_24 AC 514 ms
4,376 KB
testcase_25 AC 847 ms
4,376 KB
testcase_26 AC 433 ms
4,380 KB
testcase_27 AC 788 ms
4,376 KB
testcase_28 AC 770 ms
4,376 KB
testcase_29 AC 435 ms
4,376 KB
testcase_30 AC 488 ms
4,376 KB
testcase_31 AC 782 ms
4,376 KB
testcase_32 AC 631 ms
4,376 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#[macro_export]
macro_rules! setup {
    { mut $input:ident: SplitWhitespace $(,)? } => {
        use std::io::Read;
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).ok();
        let mut $input = buf.split_whitespace();
    };
}

#[macro_export]
macro_rules! parse_next {
    ($str_iter:expr) => {
        $str_iter.next().unwrap().parse().ok().unwrap()
    };
}

#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};

fn main() {
    setup! { mut input: SplitWhitespace };

    let _n: usize = parse_next!(input);
    let q: usize = parse_next!(input);
    let s: String = parse_next!(input);
    let lrx: Vec<(usize, usize, usize)> = (0..q)
        .map(|_| (parse_next!(input), parse_next!(input), parse_next!(input)))
        .collect();

    for i in 0..q {
        let (l, r, x) = lrx[i];

        let ans = (|| {
            let mut cs = s[(l - 1)..=(r - 1)].to_owned().chars().collect::<Vec<_>>();
            cs.sort();
            cs[x - 1]
        })();

        println!("{}", ans);
    }
}
0