Submission #15495636


Source Code Expand

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

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

    let mut t = 0;
    let mut i = 0;
    while let Some(i_r) = s.iter().rposition(|&s_i| s_i == '.') {
        if i + r > i_r {
            for j in i..std::cmp::min(i + r, n) {
                s[j] = 'o';
            }
        } else if s[i] == '.' {
            for j in i..std::cmp::min(i + r, n) {
                s[j] = 'o';
            }
        } else {
            i += 1;
        }
        t += 1;
    }

    let ans = t;
    println!("{}", ans);
}

Submission Info

Submission Time
Task B - 直線塗り
User bouzuya
Language Rust (1.42.0)
Score 100
Code Size 600 Byte
Status
Exec Time 6 ms
Memory 2164 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, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt 6 ms 2104 KB
01-02.txt 2 ms 2040 KB
01-03.txt 2 ms 2088 KB
01-04.txt 2 ms 1960 KB
01-05.txt 1 ms 2164 KB
01-06.txt 1 ms 2052 KB
01-07.txt 1 ms 2120 KB
01-08.txt 1 ms 2056 KB
01-09.txt 1 ms 2112 KB
01-10.txt 2 ms 2004 KB
01-11.txt 2 ms 1936 KB
01-12.txt 2 ms 2108 KB
01-13.txt 1 ms 1968 KB
01-14.txt 2 ms 2052 KB
01-15.txt 1 ms 2072 KB
01-16.txt 2 ms 1956 KB
01-17.txt 1 ms 2072 KB
01-18.txt 2 ms 2064 KB
sample-01.txt 2 ms 2040 KB
sample-02.txt 1 ms 2140 KB
sample-03.txt 1 ms 2084 KB