結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー phspls
提出日時 2022-09-30 10:09:36
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 768 bytes
コンパイル時間 14,129 ms
コンパイル使用メモリ 378,692 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-22 18:40:27
合計ジャッジ時間 15,454 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `n`
 --> src/main.rs:8:9
  |
8 |     let n = nm[0];
  |         ^ help: if this is intentional, prefix it with an underscore: `_n`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `m`
 --> src/main.rs:9:9
  |
9 |     let m = nm[1];
  |         ^ help: if this is intentional, prefix it with an underscore: `_m`

ソースコード

diff #

use std::collections::BTreeSet;


fn main() {
    let mut nm = String::new();
    std::io::stdin().read_line(&mut nm).ok();
    let nm: Vec<usize> = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nm[0];
    let m = nm[1];
    let mut x = String::new();
    std::io::stdin().read_line(&mut x).ok();
    let x: Vec<usize> = x.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let mut y = String::new();
    std::io::stdin().read_line(&mut y).ok();
    let y: BTreeSet<usize> = y.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    for &v in x.iter() {
        if let Some(w) = y.range(v..).nth(0) {
            println!("{}", w-v);
        } else {
            println!("Infinity");
        }
    }
}
0