2017-05-24から1日間の記事一覧

AtCoder Grand Contest 013 C - Ants on a Circle

問題 http://agc013.contest.atcoder.jp/tasks/agc013_c 解法 解説の通りにやった。Rustでは map を使って for を消せることを学んだ。 コード use std::fmt::Debug; use std::io; use std::io::{Read, Stdin}; use std::str; use std::str::FromStr; use st…

CS Academy Round #29: Root Change

問題 https://csacademy.com/contest/round-29/task/root-change/ツリーの各頂点 i について、 i を根とした時に切断してもツリーの高さが変化しない辺の数を出力してください。 解法 editorial のコード通りです。いわゆる全方位木dpと呼ばれる手法です。 …