結果

問題 No.2803 Bocching Star
ユーザー well-definedwell-defined
提出日時 2024-09-14 19:46:57
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,015 bytes
コンパイル時間 15,921 ms
コンパイル使用メモリ 396,216 KB
実行使用メモリ 21,044 KB
最終ジャッジ日時 2024-09-14 19:47:28
合計ジャッジ時間 22,219 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 WA -
testcase_02 AC 1 ms
6,816 KB
testcase_03 AC 10 ms
6,944 KB
testcase_04 AC 53 ms
10,880 KB
testcase_05 AC 24 ms
6,944 KB
testcase_06 AC 5 ms
6,940 KB
testcase_07 AC 23 ms
6,944 KB
testcase_08 AC 11 ms
6,944 KB
testcase_09 AC 49 ms
9,600 KB
testcase_10 AC 54 ms
9,736 KB
testcase_11 AC 70 ms
14,984 KB
testcase_12 AC 21 ms
6,944 KB
testcase_13 AC 42 ms
8,404 KB
testcase_14 AC 30 ms
6,948 KB
testcase_15 AC 73 ms
16,392 KB
testcase_16 AC 38 ms
9,644 KB
testcase_17 AC 12 ms
6,940 KB
testcase_18 AC 7 ms
6,940 KB
testcase_19 AC 46 ms
9,376 KB
testcase_20 AC 30 ms
7,196 KB
testcase_21 AC 22 ms
6,944 KB
testcase_22 AC 26 ms
6,940 KB
testcase_23 AC 62 ms
12,192 KB
testcase_24 AC 88 ms
20,520 KB
testcase_25 AC 82 ms
17,788 KB
testcase_26 AC 83 ms
18,660 KB
testcase_27 AC 66 ms
13,788 KB
testcase_28 AC 75 ms
15,972 KB
testcase_29 AC 63 ms
12,836 KB
testcase_30 AC 86 ms
19,232 KB
testcase_31 AC 60 ms
11,804 KB
testcase_32 AC 90 ms
21,044 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 1 ms
6,940 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main () {
    input! {
        n: usize,
        s: i64,
        p: [i64; n],
    }
    if n == 1 {
        println!("{}", 1);
    }
    else if n == 2 {
        println!("{} {}", 1, 2);
    }
    else {
        let mut p = p.iter()
            .enumerate()
            .map(|(i, &x)| {
                (x, i+1)
            })
            .collect::<Vec<_>>();
        p.sort();
        let mut ans = p.windows(3)
            .filter(|w| {
                (w[0].0-w[1].0).abs() > s && (w[2].0-w[1].0).abs() > s
            })
            .collect::<Vec<_>>()
            .iter()
            .map(|&w| {
                w[1].1
            })
            .collect::<Vec<_>>();
        if (p[1].0-p[0].0).abs() > s { ans.push(p[0].1) };
        if (p[n-1].0-p[n-2].0).abs() > s { ans.push(p[n-1].1) };
        ans.sort();
        println!("{}", ans.len());
        println!("{}", ans.iter()
            .map(|&x| x.to_string())
            .collect::<Vec<_>>()
            .join(" "));
    }
}
0