ADDED SRM/644-U/1A.cpp Index: SRM/644-U/1A.cpp ================================================================== --- SRM/644-U/1A.cpp +++ SRM/644-U/1A.cpp @@ -0,0 +1,132 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; +typedef long long LL; +typedef complex CMP; + +static const unsigned MODVAL = 1000000007; +struct mint +{ + unsigned val; + mint():val(0){} + mint(int x):val(x%MODVAL) {} + mint(unsigned x):val(x%MODVAL) {} + mint(LL x):val(x%MODVAL) {} +}; +mint& operator+=(mint& x, mint y) { return x = x.val+y.val; } +mint& operator-=(mint& x, mint y) { return x = x.val-y.val+MODVAL; } +mint& operator*=(mint& x, mint y) { return x = LL(x.val)*y.val; } +mint operator+(mint x, mint y) { return x+=y; } +mint operator-(mint x, mint y) { return x-=y; } +mint operator*(mint x, mint y) { return x*=y; } + +mint POW(mint x, LL e) { mint v=1; for(;e;x*=x,e>>=1) if(e&1) v*=x; return v; } +mint& operator/=(mint& x, mint y) { return x *= POW(y, MODVAL-2); } +mint operator/(mint x, mint y) { return x/=y; } + +vector FAC_(1,1); +mint FAC(LL n) { while( FAC_.size()<=n ) FAC_.push_back( FAC_.back()*(LL)FAC_.size() ); return FAC_[n]; } + +mint C(LL n, LL k) { return k<0 || n osize, int M, int K) + { + mint ans = 0; + + sort(osize.begin(), osize.end()); + for(int s=0; s +double start_time; string timer() + { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); } +template ostream& operator<<(ostream& os, const vector& v) + { os << "{ "; + for(typename vector::const_iterator it=v.begin(); it!=v.end(); ++it) + os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; } +void verify_case(const int& Expected, const int& Received) { + bool ok = (Expected == Received); + if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl; + cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } } +#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock(); +#define END verify_case(_, OkonomiyakiParty().count(osize, M, K));} +int main(){ + +CASE(0) + int osize_[] = {1,4,6,7,9}; + vector osize(osize_, osize_+sizeof(osize_)/sizeof(*osize_)); + int M = 2; + int K = 3; + int _ = 6; +END +CASE(1) + int osize_[] = {1,6,2,7,4,2,6,1,5,2,4}; + vector osize(osize_, osize_+sizeof(osize_)/sizeof(*osize_)); + int M = 4; + int K = 3; + int _ = 60; +END +CASE(2) + int osize_[] = {1,4,5,7,10,11,13,16,18}; + vector osize(osize_, osize_+sizeof(osize_)/sizeof(*osize_)); + int M = 4; + int K = 5; + int _ = 0; +END +CASE(3) + int osize_[] = {55,2,7,232,52,5,5332,623,52,6,532,5147}; + vector osize(osize_, osize_+sizeof(osize_)/sizeof(*osize_)); + int M = 6; + int K = 10000; + int _ = 924; +END +CASE(4) + int osize_[] = {5781,8708,1754,4750,9888,3675,4810,1020,922,9834,5695,1101,1236,2496,8431,6727, +1376,3373,4423,1839,7438,9407,1851,6966,8715,2905,542,535,8980,2602,2603,3117,3452, +5682,7775,4356,5140,8923,9801,3729}; + vector osize(osize_, osize_+sizeof(osize_)/sizeof(*osize_)); + int M = 15; + int K = 4003; + int _ = 114514; +END +/* +CASE(5) + int osize_[] = ; + vector osize(osize_, osize_+sizeof(osize_)/sizeof(*osize_)); + int M = ; + int K = ; + int _ = ; +END +CASE(6) + int osize_[] = ; + vector osize(osize_, osize_+sizeof(osize_)/sizeof(*osize_)); + int M = ; + int K = ; + int _ = ; +END +*/ +} +// END CUT HERE