bouzuya.hatenablog.com

ぼうずやのにっき

bouzuya/firestore-structured-query 0.8.2 / ADT EASY 20240312_1

AtCoder 以外でほとんどコードを書いていない、良くない。

bouzuya/firestore-structured-query を 0.8.2 にした。 FieldPath::new\エスケープに失敗していたので修正した。

GitHub のプロフィールページに表示されるリポジトリである bouzuya/bouzuya を変更して crates.io の crate のバージョンのバッジやダウンロード数のバッジを表示してみた。


AtCoder Daily Training EASY 2024/03/12 15:30start

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

fn main() {
    input! {
        _n: usize,
        m: usize,
        s: Chars,
    };
    let mut max = 0_usize;
    let mut count1 = 0;
    let mut count2 = 0;
    for c in s.iter().copied().rev() {
        match c {
            '0' => {
                count1 = 0;
                count2 = 0;
            }
            '1' => {
                if count1 < m {
                    count1 += 1;
                } else {
                    count2 += 1;
                    max = max.max(count2);
                }
            }
            '2' => {
                count2 += 1;
                max = max.max(count2);
            }
            _ => unreachable!(),
        }
    }
    let ans = max;
    println!("{}", ans);
}

今日のコミット。