2019-03-31から1日間の記事一覧
https://codeforces.com/contest/1142/problem/B長さNの順列Pと、長さMの数列Aがある。 数列Aの要素は[1,N]である。 これについて以下のクエリに答える。 A[L,R]の部分列でvalidな部分列が存在するなら1, 存在しないなら0を答える。 valid ⇔ 順列Pを0回以上…
https://codeforces.com/contest/1142/problem/A円状に頂点1から頂点nkまで並んでいる。 1, K+1, 2K+1, ...のようにN個のお店がある。 最初に頂点sと距離lを決める。 s, s+l, s+2l, ... のように距離lで頂点の数が増える方向に移動して、sに戻ってきたら操作…
https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_d 前提知識 動的計画法 解説 https://atcoder.jp/contests/exawizards2019/submissions/4770817 DPテクを組み合わせる。 「2. 選択するものを最初にソートしておくと、DPできたり、状態を…
https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_c 前提知識 二分探索 解説 https://atcoder.jp/contests/exawizards2019/submissions/4778445check(x) := x番目にあるゴーレムが全呪文を終えた後にある位置 これを作ってみると、 -1 -1 -…
https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_b 解説 https://atcoder.jp/contests/exawizards2019/submissions/4764937BとRの数を数えて、B<RならYesと答える問題。 どんなふうに数えてもいいが、map<char,int>で数えている。 int …
https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_a 解説 https://atcoder.jp/contests/exawizards2019/submissions/4778304正三角形となるのは、全ての辺の長さが等しいときである。 なので、それを確かめればいい。 int A, B, C; //-----…