提出 #40242737


ソースコード 拡げる

#[allow(unused_imports)]
use petgraph::unionfind::UnionFind;
#[allow(unused_imports)]
use proconio::{fastout, input, marker::Chars, marker::Usize1};
#[allow(unused_imports)]
use std::collections::{BTreeSet, HashSet, VecDeque};

#[fastout]
fn main() {
    input! {
        n:usize , x:i128,
        mut a:[i128;n],
    }
    if x == 0 {
        println!("Yes");
        return;
    }
    a.sort();
    for i in 0..n {
        if let Ok(b) = a.binary_search(&(a[i] as i128)) {
            if let Ok(_) = a.binary_search(&(a[i] as i128 - x as i128)) {
                println!("Yes");
                return;
            } else if let Ok(_) = a.binary_search(&(x as i128 + a[i])) {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
}

提出情報

提出日時
問題 C - Gap Existence
ユーザ sou31415
言語 Rust (1.42.0)
得点 300
コード長 788 Byte
結果 AC
実行時間 617 ms
メモリ 8484 KiB

コンパイルエラー

warning: unused variable: `b`
  --> src/main.rs:20:19
   |
20 |         if let Ok(b) = a.binary_search(&(a[i] as i128)) {
   |                   ^ help: consider prefixing with an underscore: `_b`
   |
   = note: `#[warn(unused_variables)]` on by default

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 24
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 6 ms 2088 KiB
random_02.txt AC 2 ms 2104 KiB
random_03.txt AC 593 ms 8316 KiB
random_04.txt AC 588 ms 8376 KiB
random_05.txt AC 565 ms 7052 KiB
random_06.txt AC 613 ms 8360 KiB
random_07.txt AC 615 ms 8348 KiB
random_08.txt AC 610 ms 8484 KiB
random_09.txt AC 601 ms 8380 KiB
random_10.txt AC 611 ms 8300 KiB
random_11.txt AC 616 ms 8424 KiB
random_12.txt AC 605 ms 8364 KiB
random_13.txt AC 605 ms 8372 KiB
random_14.txt AC 612 ms 8344 KiB
random_15.txt AC 617 ms 8348 KiB
random_16.txt AC 606 ms 8332 KiB
random_17.txt AC 590 ms 8336 KiB
random_18.txt AC 616 ms 8384 KiB
random_19.txt AC 612 ms 8420 KiB
random_20.txt AC 613 ms 8232 KiB
random_21.txt AC 595 ms 8328 KiB
sample_01.txt AC 2 ms 2004 KiB
sample_02.txt AC 2 ms 1956 KiB
sample_03.txt AC 2 ms 1940 KiB