結果

問題 No.2803 Bocching Star
ユーザー NakLon131NakLon131
提出日時 2024-07-12 21:26:01
言語 Rust
(1.77.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 1,218 bytes
コンパイル時間 15,720 ms
コンパイル使用メモリ 402,076 KB
実行使用メモリ 10,916 KB
最終ジャッジ日時 2024-07-12 21:26:21
合計ジャッジ時間 16,462 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 9 ms
6,940 KB
testcase_04 AC 49 ms
8,832 KB
testcase_05 AC 23 ms
6,944 KB
testcase_06 AC 5 ms
6,940 KB
testcase_07 AC 20 ms
6,940 KB
testcase_08 AC 10 ms
6,940 KB
testcase_09 AC 46 ms
9,600 KB
testcase_10 AC 50 ms
9,728 KB
testcase_11 AC 60 ms
9,216 KB
testcase_12 AC 19 ms
6,940 KB
testcase_13 AC 40 ms
8,448 KB
testcase_14 AC 28 ms
6,944 KB
testcase_15 AC 63 ms
8,960 KB
testcase_16 AC 33 ms
6,940 KB
testcase_17 AC 10 ms
6,940 KB
testcase_18 AC 7 ms
6,940 KB
testcase_19 AC 42 ms
8,576 KB
testcase_20 AC 27 ms
6,944 KB
testcase_21 AC 20 ms
6,940 KB
testcase_22 AC 23 ms
6,944 KB
testcase_23 AC 56 ms
9,856 KB
testcase_24 AC 78 ms
10,916 KB
testcase_25 AC 72 ms
10,660 KB
testcase_26 AC 73 ms
10,660 KB
testcase_27 AC 60 ms
9,728 KB
testcase_28 AC 65 ms
9,856 KB
testcase_29 AC 58 ms
9,856 KB
testcase_30 AC 74 ms
10,660 KB
testcase_31 AC 56 ms
9,856 KB
testcase_32 AC 79 ms
10,916 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 1 ms
6,944 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    input!{
		n: usize, s: i64,
		mut p: [i64; n],
	}

	// 両端を追加
	// (値, 元の順番)を昇順でソート
	p.push(INF);
	p.insert(0, -INF);

	let mut pp = Vec::new();
	for i in 0..n+2 {
		pp.push((p[i], i));
	}
	pp.sort();

	// 前後を見て、i-sより小さい、かつi+sより大きいものであればよい。
	let mut ans = Vec::new();
	for i in 1..=n {
		if pp[i-1].0 < pp[i].0-s && pp[i].0+s < pp[i+1].0 {
			ans.push(pp[i].1);
		}
	}

	// ansを昇順にして答える
	ans.sort();
	println!("{}", ans.len());
	for i in 0..ans.len()-1 {
		print!("{} ", ans[i]);
	}
	println!("{}", ans[ans.len()-1]);
	
}

// const MOD17: usize = 1000000007;
// const MOD93: usize = 998244353;
const INF: i64 = 1 << 60;
// let dx = vec![!0, 0, 1, 0]; // 上左下右
// let dy = vec![0, !0, 0, 1]; // 上左下右
// let d = vec!{(!0, 0), (0, !0), (1, 0), (0, 1)}; // 上左下右

#[allow(unused)]
use proconio::{input, marker::Chars, marker::Usize1};

#[allow(unused)]
use std::{
	mem::swap,
	cmp::min, cmp::max,
	cmp::Reverse,
	collections::HashSet, collections::BTreeSet,
	collections::HashMap, collections::BTreeMap,
	collections::BinaryHeap,
	collections::VecDeque,
	iter::FromIterator,
};
0