結果
| 問題 | 
                            No.1366 交換門松列・梅
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-11-20 19:50:30 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 1,000 ms | 
| コード長 | 835 bytes | 
| コンパイル時間 | 13,836 ms | 
| コンパイル使用メモリ | 380,196 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-06-20 11:08:24 | 
| 合計ジャッジ時間 | 11,375 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 13 | 
ソースコード
use std::mem::swap;
fn is_kadomatsu(a: &Vec<isize>) -> bool {
    a[0] != a[1] && a[1] != a[2] && a[2] != a[0]
    && (*a.iter().max().unwrap() == a[1] || *a.iter().min().unwrap() == a[1])
}
fn main() {
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let mut a: Vec<isize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let mut b = String::new();
    std::io::stdin().read_line(&mut b).ok();
    let mut b: Vec<isize> = b.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    for i in 0..3 {
        for j in 0..3 {
            swap(&mut a[i], &mut b[j]);
            if is_kadomatsu(&a) && is_kadomatsu(&b) {
                println!("Yes");
                return;
            }
            swap(&mut a[i], &mut b[j]);
        }
    }
    println!("No");
}