結果
| 問題 | 
                            No.1366 交換門松列・梅
                             | 
                    
| コンテスト | |
| ユーザー | 
                             RheoTommy
                         | 
                    
| 提出日時 | 2021-01-29 21:24:52 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 1,000 ms | 
| コード長 | 3,644 bytes | 
| コンパイル時間 | 11,001 ms | 
| コンパイル使用メモリ | 400,096 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-06-20 10:55:56 | 
| 合計ジャッジ時間 | 11,875 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 13 | 
ソースコード
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]
// # ファイル構成
// - use宣言
// - libモジュール
// - main関数
// - basicモジュール
//
// 常に使うテンプレートライブラリはbasicモジュール内にあります。
// 問題に応じて使うライブラリlibモジュール内にコピペしています。
// ライブラリのコードはこちら → https://github.com/RheoTommy/at_coder
// Twitterはこちら → https://twitter.com/RheoTommy
use std::io::{stdout, BufWriter, Write};
use std::{collections::*, mem::swap};
use crate::basic::*;
use crate::lib::*;
pub mod lib {}
fn main() {
    let out = stdout();
    let mut writer = BufWriter::new(out.lock());
    let mut sc = Scanner::new();
    let a = (0..3).map(|_| sc.next_int()).collect::<Vec<_>>();
    let b = (0..3).map(|_| sc.next_int()).collect::<Vec<_>>();
    for i in 0..3 {
        for j in 0..3 {
            let mut ai = a.clone();
            let mut bi = b.clone();
            swap(&mut ai[i], &mut bi[j]);
            let mut aii = ai.clone();
            let mut bii = bi.clone();
            aii.sort();
            bii.sort();
            aii.dedup();
            bii.dedup();
            if (ai.iter().min().unwrap() == &ai[1] || ai.iter().max().unwrap() == &ai[1])
                && (bi.iter().min().unwrap() == &bi[1] || bi.iter().max().unwrap() == &bi[1])
                && ai.len() == aii.len()
                && bi.len() == bii.len()
            {
                writeln!(writer, "Yes").unwrap();
                return;
            }
        }
    }
    writeln!(writer, "{}", "No").unwrap();
}
pub mod basic {
    pub const U_INF: u128 = 1 << 60;
    pub const I_INF: i128 = 1 << 60;
    pub struct Scanner {
        buf: std::collections::VecDeque<String>,
        reader: std::io::BufReader<std::io::Stdin>,
    }
    impl Scanner {
        pub fn new() -> Self {
            Self {
                buf: std::collections::VecDeque::new(),
                reader: std::io::BufReader::new(std::io::stdin()),
            }
        }
        fn scan_line(&mut self) {
            use std::io::BufRead;
            let mut flag = 0;
            while self.buf.is_empty() {
                let mut s = String::new();
                self.reader.read_line(&mut s).unwrap();
                let mut iter = s.split_whitespace().peekable();
                if iter.peek().is_none() {
                    if flag >= 5 {
                        panic!("There is no input!");
                    }
                    flag += 1;
                    continue;
                }
                for si in iter {
                    self.buf.push_back(si.to_string());
                }
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            self.scan_line();
            self.buf
                .pop_front()
                .unwrap()
                .parse()
                .unwrap_or_else(|_| panic!("Couldn't parse!"))
        }
        pub fn next_usize(&mut self) -> usize {
            self.next()
        }
        pub fn next_int(&mut self) -> i128 {
            self.next()
        }
        pub fn next_uint(&mut self) -> u128 {
            self.next()
        }
        pub fn next_chars(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }
        pub fn next_string(&mut self) -> String {
            self.next()
        }
        pub fn next_char(&mut self) -> char {
            self.next()
        }
        pub fn next_float(&mut self) -> f64 {
            self.next()
        }
    }
}
            
            
            
        
            
RheoTommy