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

SRM508 Div2 Easy(250) CandyShop

CandyShop #include <vector> using namespace std; class CandyShop{public: int countProbablePlaces( vector <int> X, vector <int> Y, vector <int> R ) { int n = (int)X.size(); int c = 0; for ( int x=-200; x<=200; x++ ) for ( int y=-200; y<=200; y++ ) { bool f = true</int></int></int></vector>…

SRM508 Div1 Medium(500) YetAnotherORProblem

YetAnotherORProblem論理和と和が等しくなるのは、2進数でi桁目が1であるAxの個数が高々1個の場合。各桁ごとにAxのどれか1個に1を割り振るか、全てを0にする、場合の数を考える。Aiのj桁目に値を割り振る時、Ai≦R[i]を満たすためには、R[i]のj桁目が1ならば0…

SRM508 Div1 Easy(250), Div2 Medium(500) DivideAndShift

DivideAndShiftシフトはいつ行っても良い。Nの約数wについて幅をwにしてからシフトを行うとすると、幅をwにするためにN/wの素因数の個数の回数分割が必要で、シフトにmin((M+w-1)%w,w-(M+w-1)%w)回かかる。 #include <algorithm> using namespace std; class DivideAndS</algorithm>…

SRM508

Easy (250) 0 Medium (500) 0 Hard (1000) 0 Challenge -25 結果 1927 → 1747初マイナス点。これは痛いorz