結果

問題 No.2871 Universal Serial Bus
ユーザー well-defined
提出日時 2024-09-14 12:11:36
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 908 bytes
コンパイル時間 14,720 ms
コンパイル使用メモリ 379,160 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-14 12:11:53
合計ジャッジ時間 16,116 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;
use proconio::marker::Chars;

fn main () {
    input! {
        h: usize,
        _: usize,
        s: [Chars; h],
        t: [Chars; h],
    }
    let s_rev = s.iter()
        .rev()
        .map(|c| {
            c.iter().rev().cloned().collect::<Vec<_>>()
        })
        .collect::<Vec<_>>();
    let t = t.iter()
        .map(|v| {
            v.iter().map(|&c| if c == '.' {'#'} else {'.'}).collect::<Vec<_>>()
        })
        .collect::<Vec<_>>();
    match (s, s_rev, t) {
        (s, s_rev, t) 
        if (s == t) & (s_rev == t) => {
            println!("{}", 2.641632560655154);
        },
        (s, _, t)
        if s == t => {
            println!("{}", 3.531740190461733);
        },
        (_, s_rev, t)
        if s_rev == t => {
            println!("{}", 3.128936827211877);
        },
        (_, _, _) => {
            println!("{}", -1);
        },
    }
}
0