2012-12-20から1日間の記事一覧

SRM565 Div1 Medium(500) MonstersValley2

MonstersValley2全探索。 #include <vector> using namespace std; class MonstersValley2{public: int minimumPrice( vector <int> dread, vector <int> price ) { int n = (int)dread.size(); int ans = 2*n; for ( int i=0; i<1<</int></int></vector>

SRM565 Div2 Easy(250) ValueHistogram

ValueHistogram #include <string> #include <vector> #include <algorithm> using namespace std; class ValueHistogram{public: vector <string> build( vector <int> values ) { int hist[10] = {0}; for ( int i=0; i<(int)values.size(); i++ ) hist[values[i]]++; int H = *max_element(hist,hi</int></string></algorithm></vector></string>…

SRM565 Div1 Medium(500) TheDivisionGame

TheDivisionGame重複を許した素因数の個数がGrundy数となる。よって、P[i]をiの重複を許した素因数の個数として、Pの連続した部分列でxorした結果が0ではないものを数えれば良い。各iについてP[i]を求めると間に合わないが、各素数pについてpの整数倍のP[i]…

SRM565 Div1 Easy(250) MonstersValley

MonstersValley動的計画法。必要なコストごとに、最高のdreadを覚えておく。 #include <vector> #include <algorithm> using namespace std; class MonstersValley{public: int minimumPrice( vector<long long> dread, vector <int> price ) { int n = (int)dread.size(); vector<long long> T(2*n+1,-1); </long></int></long></algorithm></vector>…

SRM565

Easy (250) 218.80 Medium (500) 0 Hard (1000) 0 Challenge 0 結果 237位 2065→2047(´・ω・`)