結果
| 問題 |
No.2803 Bocching Star
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-02 15:01:20 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 785 bytes |
| コンパイル時間 | 12,125 ms |
| コンパイル使用メモリ | 401,616 KB |
| 実行使用メモリ | 19,344 KB |
| 最終ジャッジ日時 | 2024-08-02 15:01:38 |
| 合計ジャッジ時間 | 16,854 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
コンパイルメッセージ
warning: unused import: `std::arch::x86_64` --> src/main.rs:1:5 | 1 | use std::arch::x86_64; | ^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
ソースコード
use std::arch::x86_64;
fn main() {
proconio::input! {
n: usize,
s: i64,
p: [i64;n],
}
if n == 1 {
println!("1");
println!("1");
return;
}
let mut p = p.into_iter().enumerate().collect::<Vec<_>>();
p.sort_by_key(|x| x.1);
let mut flags = vec![true; n];
p.windows(2).filter(|x| x[1].1 - x[0].1 <= s).for_each(|x| {
flags[x[0].0] = false;
flags[x[1].0] = false;
});
let ind = flags
.into_iter()
.enumerate()
.filter_map(|x| x.1.then_some(x.0))
.collect::<Vec<_>>();
println!("{}", ind.len());
println!(
"{}",
ind.iter()
.map(|x| (x + 1).to_string())
.collect::<Vec<_>>()
.join(" ")
);
}