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

SRM525 Div2 Hard(950) MagicalSquare

MagicalSquareS[0][0], S[0][1], S[1][0], S[1][1]を決めれば、残りのマスも定まる。事前にrowStrings, columnStringsのそれぞれの位置からの最長一致長を求めて高速化する。 #include <string> #include <vector> using namespace std; class MagicalSquare{public: long lo</vector></string>…

SRM526 Div2 Easy(250) CheatingQuiz

CheatingQuiz #include <string> #include <set> #include <vector> using namespace std; class CheatingQuiz{public: vector <int> howMany( string answers ) { vector<int> ans; for ( int i=0; i<(int)answers.length(); i++ ) ans.push_back(set<char>(answers.begin()+i,answers.end()).siz</char></int></int></vector></set></string>…

SRM526 Div1 Medium(500) PrimeCompositeGame

PrimeCompositeGameK=1の場合はシミュレートする。K>=2のとき、2個の素数の間にKより大きな隙間があると、そこに追い込まれて私が負ける。それ以外の場合は2を取られて、Dengklekが負ける。勝つ方はなるべく多く、負ける方はなるべく少なく取れば良い。 #inc…