Particle

競技プログラミングについての雑記

2015-08-07から1日間の記事一覧

AOJ 2554 : encode/decode

解法 固有値が2の時の固有ベクトルを求めて、適当にグラフを作ると、後ろから辿ることで状態を復元できる #include <iostream> #include <string> #include <map> #include <algorithm> using namespace std; typedef pair<char, int> State; map<pair<State, int>, State> f; map<pair<State, char>, pair<State, int> > g; #define M 9 int deg[M] = {3, </state,></pair<state,></pair<state,></char,></algorithm></map></string></iostream>…

AOJ 2230: How to Create a Good Game

AOJ

LPであることと、フローっぽいことはなんとなく分かるけど、最小費用流のLP双対の形にするのが少し難しいので、1100妥当だと思う。 解法 最小費用流の双対なので、変形してから流す。 ネットワークが少し特殊な形をしてるけど、蟻本とかで調べるとやり方が書…

AOJ 2453 : Presentation

AOJ

解法 木のサイズに関する自明な枝刈りをすると計算量が落ちるから、頑張って実装する。 木を作ったり判定したりするのが大変なので工夫すると比較的楽に実装できる。 判定するときは、queueを3つくらい使うと綺麗に実装できる。 #include <iostream> #include <string> #includ</string></iostream>…