結果

問題 No.1366 交換門松列・梅
ユーザー BrightLightBrightLight
提出日時 2021-01-29 21:41:19
言語 Rust
(1.77.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,111 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 166,592 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 09:11:58
合計ジャッジ時間 1,862 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 0 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let a: Vec<usize> = read_vec();
    let b: Vec<usize> = read_vec();

    let mut ans: String = "No".to_string();
    
    for i in 0..3 {
        for j in 0..3 {
            let mut ac = a.clone();
            let mut bc = b.clone();
            let ai = a[i];
            let bj = b[j];

            ac[i] = bj;
            bc[j] = ai;

            if ac[0] != ac[1] && ac[0] != ac[2] && ac[1] != ac[2]
                && bc[0] != bc[1] && bc[0] != bc[2] && bc[1] != bc[2] {
                    if (ac[0] < ac[1] && ac[2] < ac[1]) || (ac[0] > ac[1] && ac[2] > ac[1])
                        && (bc[0] < bc[1] && bc[2] < bc[1]) || (bc[0] > bc[1] && bc[2] > bc[1]) {
                            ans = "Yes".to_string();
                    }
            }
        }
    }

    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
0