2009-12-18から1日間の記事一覧

SRM455 Div2 Medium(500) EasySequence

EasySequenceAの先頭N個と同じ数列が出てくれば以降は同じ数列が生成されるので検索を打ち切る。N≦7なのでAは長くとも107程度にしかならない。 #include <vector> #include <numeric> using namespace std; class EasySequence { public: int find( vector <int> A, vector <int> B ); b</int></int></numeric></vector>…

SRM455 Div2 Hard(1000) DonutsOnTheGrid

DonutsOnTheGridEasyと付いているDiv1の問題のほうが簡単……かと思いきや、問題サイズが大きくなっていてO(n4)では終わらない。 000000 0..... 000000 0....0 000000 0....0 000000 000000 ← y ^ ^ x1 x2左端がx1、右端がx2、下端がyのドーナツの個数は、yよ…