Submission #15496430


Source Code Expand

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

fn main() {
    input! {
        n: usize,
        mut s: [Chars; n],
    };

    let mut ans = 0;
    for i in 0..n {
        match s[i].iter().rposition(|&s_ij| s_ij == '.') {
            None => {}
            Some(i_r) => {
                for j in 0..=i_r {
                    s[i][j] = 'o';
                }
                if i + 1 < n {
                    for j in i_r..n {
                        s[i + 1][j] = 'o';
                    }
                }
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

Submission Info

Submission Time
Task C - Z塗り
User bouzuya
Language Rust (1.42.0)
Score 100
Code Size 602 Byte
Status
Exec Time 7 ms
Memory 2172 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
All 100 / 100 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt 7 ms 2116 KB
01-02.txt 1 ms 2100 KB
01-03.txt 1 ms 1988 KB
01-04.txt 2 ms 2124 KB
01-05.txt 1 ms 2116 KB
01-06.txt 3 ms 2144 KB
01-07.txt 1 ms 2168 KB
01-08.txt 2 ms 2140 KB
01-09.txt 1 ms 2168 KB
01-10.txt 1 ms 1956 KB
01-11.txt 1 ms 2160 KB
01-12.txt 1 ms 2128 KB
01-13.txt 2 ms 2140 KB
01-14.txt 1 ms 1968 KB
01-15.txt 1 ms 2148 KB
01-16.txt 1 ms 2080 KB
01-17.txt 1 ms 2108 KB
01-18.txt 2 ms 2056 KB
01-19.txt 2 ms 2172 KB
01-20.txt 1 ms 2132 KB
sample-01.txt 2 ms 2132 KB
sample-02.txt 2 ms 2072 KB
sample-03.txt 1 ms 2016 KB