Artifact 5beaeafc55fc55b64a6c1b933fbae84215bacae7
#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 ChickenOracle { public:
string theTruth(int n, int eggCount, int lieCount, int liarCount)
{
bool egg = canTruthTellerBe( eggCount, n, lieCount, liarCount );
bool chk = canTruthTellerBe( n-eggCount, n, lieCount, liarCount );
if( egg && chk ) return "Ambiguous";
if( egg ) return "The egg";
if( chk ) return "The chicken";
return "The oracle is a lie";
}
bool canTruthTellerBe( int A, int n, int B, int C )
{
int two_x = A+B+C - n;
if( (two_x&1) == 1 )
return false;
int x = two_x/2;
return 0<=x && x<=C && x<=B && (C-x)<=(n-B);
}
};
// 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(_, ChickenOracle().theTruth(n, eggCount, lieCount, liarCount));}
int main(){
CASE(0)
int n = 10;
int eggCount = 10;
int lieCount = 0;
int liarCount = 0;
string _ = "The egg";
END
CASE(1)
int n = 60;
int eggCount = 40;
int lieCount = 0;
int liarCount = 30;
string _ = "The oracle is a lie";
END
CASE(2)
int n = 60;
int eggCount = 20;
int lieCount = 5;
int liarCount = 25;
string _ = "The chicken";
END
CASE(3)
int n = 1000;
int eggCount = 500;
int lieCount = 250;
int liarCount = 250;
string _ = "Ambiguous";
END
CASE(4)
int n = 338919;
int eggCount = 310645;
int lieCount = 70422;
int liarCount = 304279;
string _ = "The oracle is a lie";
END
CASE(5)
int n = 1;
int eggCount = 0;
int lieCount = 0;
int liarCount = 0;
string _ = "The chicken";
END
}
// END CUT HERE