Artifact Content
Not logged in

Artifact d72e60e00215d96c6599cbc650e834ea761e8dbd


#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 <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class SpamChecker { public:
	string spamCheck(string judgeLog, int good, int bad)
	{
		return isBad(judgeLog, good, bad) ? "SPAM" : "NOT SPAM";
	}

	bool isBad(string judgeLog, int good, int bad)
	{
		int score = 0;
		for(char c: judgeLog)
			if((score += c=='o' ? good : -bad) < 0)
				return true;
		return false;
	}
};

// 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 string& Expected, const string& 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(_, SpamChecker().spamCheck(judgeLog, good, bad));}
int main(){

CASE(0)
	string judgeLog = "ooooxxxo"; 
	int good = 2; 
	int bad = 3; 
	string _ = "SPAM"; 
END
CASE(1)
	string judgeLog = "ooooxxxo"; 
	int good = 3; 
	int bad = 4; 
	string _ = "NOT SPAM"; 
END
CASE(2)
	string judgeLog = "xooooooooooooooooooooooooooo"; 
	int good = 1000; 
	int bad = 1; 
	string _ = "SPAM"; 
END
CASE(3)
	string judgeLog = "oxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
	int good = 1000; 
	int bad = 1; 
	string _ = "NOT SPAM"; 
END
CASE(4)
	string judgeLog = "ooxoxoxooxoxxoxoxooxoxoxoxxoxx"; 
	int good = 15; 
	int bad = 17; 
	string _ = "SPAM"; 
END
CASE(5)
	string judgeLog = "oooxoxoxoxoxoxooxooxoxooxo"; 
	int good = 16; 
	int bad = 18; 
	string _ = "NOT SPAM"; 
END
/*
CASE(6)
	string judgeLog = ; 
	int good = ; 
	int bad = ; 
	string _ = ; 
END
CASE(7)
	string judgeLog = ; 
	int good = ; 
	int bad = ; 
	string _ = ; 
END
*/
}
// END CUT HERE