Artifact Content
Not logged in

Artifact ff8a7dedf31c21ecf4ad9dba4d57b6934036da64


#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 CubeColoring { public:
	long long theCount(vector <string> colors)
	{
		const int NC = colors[0].size();

		int c1=0,c3=0,c4=0,c6=0;
		for(int i=0; i<NC; ++i) {
			c1 += colors[1][i]=='Y';
			c3 += colors[3][i]=='Y';
			c4 += colors[4][i]=='Y';
			c6 += colors[6][i]=='Y';
		}
		LL answer = 0;
		for(int i0=0; i0<NC; ++i0) if(colors[0][i0]=='Y')
		for(int i2=0; i2<NC; ++i2) if(colors[2][i2]=='Y')
		for(int i5=0; i5<NC; ++i5) if(colors[5][i5]=='Y')
		for(int i7=0; i7<NC; ++i7) if(colors[7][i7]=='Y')
		{
			int cc1 = c1 - (colors[1][i0]=='Y') - (i0!=i2 && colors[1][i2]=='Y') - (i0!=i5 && i2!=i5 && colors[1][i5]=='Y');
			int cc3 = c3 - (colors[3][i0]=='Y') - (i0!=i2 && colors[3][i2]=='Y') - (i0!=i7 && i2!=i7 && colors[3][i7]=='Y');
			int cc4 = c4 - (colors[4][i0]=='Y') - (i0!=i5 && colors[4][i5]=='Y') - (i0!=i7 && i5!=i7 && colors[4][i7]=='Y');
			int cc6 = c6 - (colors[6][i2]=='Y') - (i2!=i5 && colors[6][i5]=='Y') - (i2!=i7 && i5!=i7 && colors[6][i7]=='Y');
			answer += cc1*cc3*cc4*cc6;
		}
		return answer;
	}
};

// 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(_, CubeColoring().theCount(colors));}
int main(){

CASE(0)
	string colors_[] = {"Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"};
	  vector <string> colors(colors_, colors_+sizeof(colors_)/sizeof(*colors_)); 
	long long _ = 0LL; 
END
CASE(1)
	string colors_[] = {"YNNNNNNN", "NYNNNNNN", "NNYNNNNN", "NNNYNNNN", "NNNNYNNN", "NNNNNYNN", "NNNNNNYN", "NNNNNNNY"};
	  vector <string> colors(colors_, colors_+sizeof(colors_)/sizeof(*colors_)); 
	long long _ = 1LL; 
END
CASE(2)
	string colors_[] = {"YNNYN", "YYYYY", "NYYNY", "YNYYN", "YNNYY", "YNNYY", "NNNYY", "NYYYY"};
	  vector <string> colors(colors_, colors_+sizeof(colors_)/sizeof(*colors_)); 
	long long _ = 250LL; 
END
CASE(3)
	string colors_[] = {"YNNYN", "YYYYY", "NNNNN", "YNYYN", "YNNYY", "YNNYY", "NNNYY", "NYYYY"};
	  vector <string> colors(colors_, colors_+sizeof(colors_)/sizeof(*colors_)); 
	long long _ = 0LL; 
END
CASE(4)
	string colors_[] = {"YNNYNYYYYYNN", "NNNYNYYNYNNY", "YYNNYYNNNYYN", "YYYYYNNYYYNN", "NNNYYYNNYNYN", "YYYNYYYYNYNN", "NNNNNNYYNYYN", "NNYNYYNNYNYY"};
	  vector <string> colors(colors_, colors_+sizeof(colors_)/sizeof(*colors_)); 
	long long _ = 611480LL; 
END
/*
CASE(5)
	string colors_[] = ;
	  vector <string> colors(colors_, colors_+sizeof(colors_)/sizeof(*colors_)); 
	long long _ = LL; 
END
CASE(6)
	string colors_[] = ;
	  vector <string> colors(colors_, colors_+sizeof(colors_)/sizeof(*colors_)); 
	long long _ = LL; 
END
*/
}
// END CUT HERE