結果

問題 No.2803 Bocching Star
ユーザー ⁣
提出日時 2024-08-09 13:27:41
言語 Rust
(1.77.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 13,283 ms
コンパイル使用メモリ 378,596 KB
実行使用メモリ 18,476 KB
最終ジャッジ日時 2024-08-09 13:28:00
合計ジャッジ時間 18,806 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 9 ms
5,376 KB
testcase_04 AC 79 ms
11,076 KB
testcase_05 AC 41 ms
6,456 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 AC 23 ms
6,088 KB
testcase_08 AC 14 ms
5,376 KB
testcase_09 AC 89 ms
11,316 KB
testcase_10 AC 83 ms
11,244 KB
testcase_11 AC 68 ms
13,980 KB
testcase_12 AC 22 ms
5,844 KB
testcase_13 AC 78 ms
9,660 KB
testcase_14 AC 52 ms
7,072 KB
testcase_15 AC 66 ms
14,884 KB
testcase_16 AC 33 ms
8,888 KB
testcase_17 AC 14 ms
5,376 KB
testcase_18 AC 10 ms
5,376 KB
testcase_19 AC 73 ms
9,944 KB
testcase_20 AC 42 ms
7,124 KB
testcase_21 AC 31 ms
5,792 KB
testcase_22 AC 27 ms
6,604 KB
testcase_23 AC 95 ms
12,604 KB
testcase_24 AC 70 ms
18,228 KB
testcase_25 AC 72 ms
16,436 KB
testcase_26 AC 71 ms
17,016 KB
testcase_27 AC 78 ms
13,364 KB
testcase_28 AC 75 ms
15,160 KB
testcase_29 AC 79 ms
12,856 KB
testcase_30 AC 69 ms
17,236 KB
testcase_31 AC 82 ms
12,216 KB
testcase_32 AC 66 ms
18,476 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::collections::BTreeSet;

fn g() -> Vec<usize> {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.split_whitespace().flat_map(str::parse).collect()
}
fn main() {
	let n = g();
	let mut p = g()
		.iter()
		.enumerate()
		.map(|(i, &p)| (p, i + 1))
		.collect::<Vec<_>>();
	p.sort();
	let mut b = BTreeSet::new();
	for t in p.windows(2) {
		if t[1].0 - t[0].0 <= n[1] {
			b.insert(t[0].1);
			b.insert(t[1].1);
		}
	}
	let a = BTreeSet::from_iter(1..=n[0]);
	let a = a.difference(&b);
	println!(
		"{}\n{}",
		a.clone().count(),
		a.map(|&x| x.to_string()).collect::<Vec<_>>().join(" ")
	)
}
0