2024-01-01 bouzuya/serde-firestore-value 0.3.0 をつくった / PAST #2 F
bouzuya/serde-firestore-value を 0.3.0 にした。
Option<chrono::DateTime<chrono::Utc>>
の with の mod を追加したOption<time::OffsetDateTime>
の with の mod を追加した
いくつかの doctest を追加している。テストが重複コードになっており、どうしたものだろう。ドキュメントの Examples はほしい (がテストの実行速度が遅い) 。 0.3.0 での CHANGELOG 代わりのテストもほしい (が重複する) 。難しい。
TODO の多くを捨てた。思い切って捨ててみようと思った。積んでいてもどうせ処理できないなら積まないほうが良いかもしれないので試しに消してみる。本棚から本を捨てる気持ち。
風邪っぽい。鼻水が出てのどがおかしい。
PAST #2 第二回 アルゴリズム実技検定 過去問
- F - タスクの消化
https://atcoder.jp/contests/past202004-open/tasks/past202004_f
- 提出: https://atcoder.jp/contests/past202004-open/submissions/48971584
- k 日時点で選択可能なもののうち最大のものを選択すれば良い
- ab を a で昇順にソートしておく
- 日ごとに a_i が k 以下のものを走査して選択可能な要素の集合に移動する
- 選択可能な要素の集合を BTreeMap で b とその個数で管理する
use std::collections::BTreeMap;
use proconio::{input, marker::Usize1};
fn main() {
input! {
n: usize,
mut ab: [(Usize1, usize); n]
};
ab.sort();
let mut index = 0_usize;
let mut map = BTreeMap::new();
let mut sum = 0_usize;
for k in 0..n {
while index < ab.len() && ab[index].0 <= k {
*map.entry(ab[index].1).or_insert(0) += 1;
index += 1;
}
let max = *map.keys().next_back().unwrap();
let count = map.get_mut(&max).unwrap();
*count -= 1;
if *count == 0 {
map.remove(&max);
}
sum += max;
println!("{}", sum);
}
}
今日のコミット。
- expo-push-notification-client-rust 0 commit
- rust-atcoder 1 commit
- serde-firestore-value 6 commits