提出 #39377821


ソースコード 拡げる

#![allow(unused_imports)]

fn main() {
    input! {
        (h,w): (usize, usize),
        c: [Chars; h],
    }
    let mut d = UnionFind::new(h*w);
    for i in 0..h {
        for j in 0..w {
            if c[i][j] != 'o' { continue; }
            for (di, dj) in [(0,1), (1,0), (1,1)].iter() {
                let (ni, nj) = (i+di, j+dj);
                if ni == h || nj == w || c[ni][nj] != 'o' { continue; }
                d.union(i*w+j, ni*w+nj);
            }
            if i > 0 {
                let (ni, nj) = (i-1, j+1);
                if nj == w || c[ni][nj] != 'o' { continue; }
                d.union(i*w+j, ni*w+nj);
            }
        }
    }
    let mut tmp = vec![0; h*w];
    for l in d.into_labeling() {
        tmp[l] += 1;
    }
    let mut cnt = vec![0; h*w+1];
    for t in tmp {
        cnt[t] += 1;
    }
    let mut ans = (0, 0, 0);
    for i in 1..1000 {
        if let Some(v) = cnt.get(12*i*i) { ans.0 += v; }
        if let Some(v) = cnt.get(16*i*i) { ans.1 += v; }
        if let Some(v) = cnt.get(11*i*i) { ans.2 += v; }
    }
    println!("{} {} {}", ans.0, ans.1, ans.2);
}

use proconio::{
    input,
    marker::*,
};
use petgraph::unionfind::UnionFind;
use itertools::Itertools;

提出情報

提出日時
問題 D - アルファベット探し
ユーザ QiToY
言語 Rust (1.42.0)
得点 100
コード長 1270 Byte
結果 AC
実行時間 39 ms
メモリ 22548 KiB

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 58
セット名 テストケース
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rndsmall_00.txt, 01_rndsmall_01.txt, 01_rndsmall_02.txt, 01_rndsmall_03.txt, 01_rndsmall_04.txt, 01_rndsmall_05.txt, 01_rndsmall_06.txt, 01_rndsmall_07.txt, 01_rndsmall_08.txt, 01_rndsmall_09.txt, 01_rndsmall_10.txt, 01_rndsmall_11.txt, 01_rndsmall_12.txt, 01_rndsmall_13.txt, 01_rndsmall_14.txt, 01_rndsmall_15.txt, 01_rndsmall_16.txt, 01_rndsmall_17.txt, 01_rndsmall_18.txt, 01_rndsmall_19.txt, 02_rndmax_00.txt, 02_rndmax_01.txt, 02_rndmax_02.txt, 02_rndmax_03.txt, 02_rndmax_04.txt, 02_rndmax_05.txt, 02_rndmax_06.txt, 02_rndmax_07.txt, 02_rndmax_08.txt, 02_rndmax_09.txt, 02_rndmax_10.txt, 02_rndmax_11.txt, 02_rndmax_12.txt, 02_rndmax_13.txt, 02_rndmax_14.txt, 02_rndmax_15.txt, 02_rndmax_16.txt, 02_rndmax_17.txt, 02_rndmax_18.txt, 02_rndmax_19.txt, 03_rnd_00.txt, 03_rnd_01.txt, 03_rnd_02.txt, 03_rnd_03.txt, 03_rnd_04.txt, 03_rnd_05.txt, 03_rnd_06.txt, 03_rnd_07.txt, 03_rnd_08.txt, 03_rnd_09.txt, 04_empty_00.txt, 05_maxret_00.txt
ケース名 結果 実行時間 メモリ
00_min.txt AC 6 ms 2120 KiB
00_sample_01.txt AC 2 ms 1944 KiB
00_sample_02.txt AC 2 ms 2068 KiB
00_sample_03.txt AC 2 ms 2100 KiB
00_sample_04.txt AC 2 ms 2064 KiB
00_sample_05.txt AC 2 ms 2148 KiB
01_rndsmall_00.txt AC 2 ms 2252 KiB
01_rndsmall_01.txt AC 2 ms 2300 KiB
01_rndsmall_02.txt AC 2 ms 2368 KiB
01_rndsmall_03.txt AC 2 ms 2252 KiB
01_rndsmall_04.txt AC 3 ms 2308 KiB
01_rndsmall_05.txt AC 2 ms 2308 KiB
01_rndsmall_06.txt AC 3 ms 2268 KiB
01_rndsmall_07.txt AC 2 ms 2208 KiB
01_rndsmall_08.txt AC 2 ms 2356 KiB
01_rndsmall_09.txt AC 2 ms 2352 KiB
01_rndsmall_10.txt AC 2 ms 2284 KiB
01_rndsmall_11.txt AC 2 ms 2376 KiB
01_rndsmall_12.txt AC 2 ms 2260 KiB
01_rndsmall_13.txt AC 2 ms 2208 KiB
01_rndsmall_14.txt AC 2 ms 2324 KiB
01_rndsmall_15.txt AC 2 ms 2328 KiB
01_rndsmall_16.txt AC 2 ms 2300 KiB
01_rndsmall_17.txt AC 2 ms 2212 KiB
01_rndsmall_18.txt AC 2 ms 2360 KiB
01_rndsmall_19.txt AC 2 ms 2304 KiB
02_rndmax_00.txt AC 32 ms 22548 KiB
02_rndmax_01.txt AC 38 ms 22456 KiB
02_rndmax_02.txt AC 35 ms 22480 KiB
02_rndmax_03.txt AC 37 ms 22528 KiB
02_rndmax_04.txt AC 34 ms 22360 KiB
02_rndmax_05.txt AC 36 ms 22456 KiB
02_rndmax_06.txt AC 38 ms 22496 KiB
02_rndmax_07.txt AC 36 ms 22492 KiB
02_rndmax_08.txt AC 34 ms 22476 KiB
02_rndmax_09.txt AC 35 ms 22440 KiB
02_rndmax_10.txt AC 35 ms 22464 KiB
02_rndmax_11.txt AC 32 ms 22472 KiB
02_rndmax_12.txt AC 32 ms 22400 KiB
02_rndmax_13.txt AC 37 ms 22360 KiB
02_rndmax_14.txt AC 39 ms 22312 KiB
02_rndmax_15.txt AC 36 ms 22372 KiB
02_rndmax_16.txt AC 36 ms 22460 KiB
02_rndmax_17.txt AC 34 ms 22360 KiB
02_rndmax_18.txt AC 34 ms 22468 KiB
02_rndmax_19.txt AC 36 ms 22472 KiB
03_rnd_00.txt AC 9 ms 2492 KiB
03_rnd_01.txt AC 10 ms 6380 KiB
03_rnd_02.txt AC 10 ms 6408 KiB
03_rnd_03.txt AC 13 ms 7096 KiB
03_rnd_04.txt AC 14 ms 7848 KiB
03_rnd_05.txt AC 5 ms 3280 KiB
03_rnd_06.txt AC 17 ms 9496 KiB
03_rnd_07.txt AC 12 ms 4532 KiB
03_rnd_08.txt AC 19 ms 12776 KiB
03_rnd_09.txt AC 17 ms 11140 KiB
04_empty_00.txt AC 28 ms 22484 KiB
05_maxret_00.txt AC 32 ms 22476 KiB