Artifact Content
Not logged in

Artifact a26c173c3d2bd17e7f19772aeabc11a3e480ce7c


#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 NotTwo { public:
	int maxStones(int width, int height) 
	{
		return ms( (width+1)/2, (height+1)/2 )
			+  ms( (width+1)/2, height/2 )
			+  ms( width/2, (height+1)/2 )
			+  ms( width/2, height/2 );
	}
	int ms( int w, int h )
	{
		return ((w+1)/2) * ((h+1)/2) + (w/2)*(h/2);
	}
};

// 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 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(_, NotTwo().maxStones(width, height));}
int main(){

CASE(0)
	int width = 3; 
	int height = 2; 
	int _ = 4; 
END
CASE(1)
	int width = 3; 
	int height = 3; 
	int _ = 5; 
END
CASE(2)
	int width = 8; 
	int height = 5; 
	int _ = 20; 
END
CASE(3)
	int width = 1; 
	int height = 1; 
	int _ = 1; 
END
CASE(4)
	int width = 1; 
	int height = 2; 
	int _ = 2; 
END
CASE(5)
	int width = 1; 
	int height = 3; 
	int _ = 2; 
END

}
// END CUT HERE