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

SRM343 div2 hard

全探索で大丈夫だけど、 かなりTLEしやすいので引数をグローバルにしたりして定数項を落とさないといけない。 メモ化したほうがいい。 #include <string> #include <vector> #include <iostream> using namespace std; class Mafia { public: int n,mine; int responses[16][16]; vector<int></int></iostream></vector></string>…

SRM441 div2 hard

分からない上に、公式の解説がないので諦める。

SRM400 div2 hard

DPではない。 最初の行と最初の列だけビットで全探索すればあとは左上を見るだけで全部決められる。 #include <string> #include <vector> using namespace std; class LightedPanels { public: int h,w; vector<string> board,tmp; int popCount(int _mask) { int r=0; for(int i=0;i</string></vector></string>…

SRM319 div2 hard

5時間かかったorz #include <sstream> #include <string> #include <vector> using namespace std; class IncompleteBST { public: char tree[(1<<20)]; bool rec(int cur,char bottom,char ceil) { if((1<<20)<=cur || tree[cur]=='#') return true; if(tree[cur]</vector></string></sstream>