Artifact 177e44b83c8f6a8713c5443d569b747edb111358
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
class DiceGames { public:
long long countFormations(vector <int> sides)
{
sort(sides.begin(), sides.end());
vector<LL> dp(sides.back(), 0);
dp[0] = 1;
for(int i=0; i<sides.size(); ++i)
partial_sum(dp.begin(), dp.begin()+sides[i], dp.begin());
return accumulate(dp.begin(), dp.end(), 0LL);
}
};
// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
{ ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
{ os << "{ ";
for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const long long& Expected, const long long& 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(_, DiceGames().countFormations(sides));}
int main(){
CASE(0)
int sides_[] = {4};
vector <int> sides(sides_, sides_+sizeof(sides_)/sizeof(*sides_));
long long _ = 4LL;
END
CASE(1)
int sides_[] = {2, 2};
vector <int> sides(sides_, sides_+sizeof(sides_)/sizeof(*sides_));
long long _ = 3LL;
END
CASE(2)
int sides_[] = {4, 4};
vector <int> sides(sides_, sides_+sizeof(sides_)/sizeof(*sides_));
long long _ = 10LL;
END
CASE(3)
int sides_[] = {3, 4};
vector <int> sides(sides_, sides_+sizeof(sides_)/sizeof(*sides_));
long long _ = 9LL;
END
CASE(4)
int sides_[] = {4, 5, 6};
vector <int> sides(sides_, sides_+sizeof(sides_)/sizeof(*sides_));
long long _ = 48LL;
END
CASE(5)
int sides_[] = {1};
vector <int> sides(sides_, sides_+sizeof(sides_)/sizeof(*sides_));
long long _ = 1LL;
END
CASE(6)
int sides_[] = {1,1,1,1,1,1,1,1,1,1};
vector <int> sides(sides_, sides_+sizeof(sides_)/sizeof(*sides_));
long long _ = 1LL;
END
}
// END CUT HERE