2011-03-14から1日間の記事一覧

SRM314 div2 hard

方針が間違ってて何度もTLEした。 cache[すでに使ったフェンス(bit)]でメモれば一発。 #include <cmath> #include <vector> #include <algorithm> using namespace std; class GrasslandFencer { public: vector<int> fences; double cache[(1<<16)]; int n; double heron(int _a,int _b,int</int></algorithm></vector></cmath>…

SRM363 div2 hard

メモ化再起で書いた。n=15に脊髄反射でbitDP的な感じ。 cache[何回目][すでにインストールされているもの(bit)]でメモ化。 #include <string> #include <sstream> #include <vector> using namespace std; class CrazyComponents { public: double cache[55][(1<<15)]; vector<int> require</int></vector></sstream></string>…

SRM366 div2 hard

最初に選ぶ所を決めたら、1回選ぶごとに右と左に分けて考えられる ターン制の問題は実装が多くなるから嫌い たぶんDPでもできる。 ていうかこのコードはちょっと頭が悪いので計算量が2倍になっている #include <cstring> #include <cstdio> #include <utility> #include <vector> using namespa</vector></utility></cstdio></cstring>…