結果

問題 No.1366 交換門松列・梅
ユーザー seinyan
提出日時 2021-11-05 20:53:18
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 797 bytes
コンパイル時間 11,046 ms
コンパイル使用メモリ 400,752 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 11:04:39
合計ジャッジ時間 11,801 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

fn input_line<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect()
}

fn main() {
    let mut a = input_line::<u32>();
    let mut b = input_line::<u32>();

    for i in 0..3 {
        for j in 0..3 {
            std::mem::swap(&mut a[i], &mut b[j]);
            if check(&a) && check(&b) {
                println!("Yes");
                return;
            } else {
                std::mem::swap(&mut a[i], &mut b[j]);
            }
        }
    }
    println!("No");
}

fn check(a: &Vec<u32>) -> bool {
    ((a[0] < a[1] && a[1] > a[2]) || (a[0] > a[1] && a[1] < a[2]))
        && (a[0] != a[1] && a[1] != a[2] && a[0] != a[2])
}
0