結果

問題 No.2871 Universal Serial Bus
ユーザー Yukino DX.
提出日時 2024-10-23 12:20:17
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 14,903 ms
コンパイル使用メモリ 403,032 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-23 12:20:34
合計ジャッジ時間 14,915 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::{input, marker::Chars};

fn main() {
    input! {
        h:usize,
        w:usize,
        s:[Chars;h],
        t:[Chars;h],
    }

    let mut s_rev = vec![vec!['.'; w]; h];
    for i in 0..h {
        for j in 0..w {
            s_rev[i][w - j - 1] = s[h - i - 1][j];
        }
    }

    let f1 = (0..h).all(|i| (0..w).all(|j| s[i][j] != t[i][j]));
    let f2 = (0..h).all(|i| (0..w).all(|j| s_rev[i][j] != t[i][j]));

    let ans = if f1 && f2 {
        2.641632560655154
    } else if f1 {
        3.531740190461733
    } else if f2 {
        3.128936827211877
    } else {
        -1.0
    };

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