#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 TheBoringGameDivOne { public:
vector <int> find(int sJ, int kJ, int sB, int kB, int sF, int kF)
{
// init:
// ( 0, 0, 0, 0, 0, 0)
// possible transitions:
// (+1,+1, 0, 0, 0, 0)
// ( 0, 0,+1,+1, 0, 0)
// ( 0,+2, 0, 0, 0, 0)
// ( 0, 0, 0,+2, 0, 0)
// (+1,+1, 0, 0,+1,+1)
// ( 0, 0,+1,+1,+1,+1)
// ( 0, 0, 0, 0,+2,+2)
// (-1,+1, 0, 0,+1,+1)
// ( 0, 0,-1,+1,+1,+1)
vector<int> result;
if(sF!=kF)
return result;
for(int f=0; 2*f<=sF; ++f)
{
int ff = sF - 2*f;
if( kJ-ff>=0 && sB-ff>=0 )
{
vector<int> c = calc(sJ+ff, kJ-ff, sB+ff, kB-ff);
if( !c.empty() )
{
c[0] += f+ff;
c[1] += f+ff;
if( result.empty() )
result = c;
else {
result[0] = min(result[0],c[0]);
result[1] = max(result[1],c[1]);
}
}
}
}
return result;
}
vector<int> calc(int sJ, int kJ, int sB, int kB)
{
// init:
// ( 0, 0, 0, 0,)
// possible transitions:
// (+1,+1, 0, 0)
// ( 0, 0,+1,+1)
// ( 0,+2, 0, 0)
// ( 0, 0, 0,+2)
if(kJ<sJ || kB<sB || (kJ-sJ)%2==1 || (kB-sB)%2==1)
return vector<int>();
return vector<int>(2, sJ+(kJ-sJ)/2 + sB+(kB-sB)/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 vector <int>& Expected, const vector <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(_, TheBoringGameDivOne().find(scoreJ, killedJ, scoreB, killedB, scoreF, killedF));}
int main(){
CASE(0)
int scoreJ = 1;
int killedJ = 1;
int scoreB = 1;
int killedB = 1;
int scoreF = 2;
int killedF = 2;
int __[] = {2, 3 };
vector <int> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(1)
int scoreJ = 0;
int killedJ = 0;
int scoreB = 0;
int killedB = 0;
int scoreF = 0;
int killedF = 0;
int __[] = {0, 0 };
vector <int> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(2)
int scoreJ = 4;
int killedJ = 7;
int scoreB = -2;
int killedB = 5;
int scoreF = 1;
int killedF = 9;
vector <int> _;
END
CASE(3)
int scoreJ = 1;
int killedJ = 5;
int scoreB = -1;
int killedB = 4;
int scoreF = 3;
int killedF = 6;
int __[] = {8, 9 };
vector <int> _(__, __+sizeof(__)/sizeof(*__));
END
/*
CASE(4)
int scoreJ = ;
int killedJ = ;
int scoreB = ;
int killedB = ;
int scoreF = ;
int killedF = ;
int __[] = ;
vector <int> _(__, __+sizeof(__)/sizeof(*__));
END
CASE(5)
int scoreJ = ;
int killedJ = ;
int scoreB = ;
int killedB = ;
int scoreF = ;
int killedF = ;
int __[] = ;
vector <int> _(__, __+sizeof(__)/sizeof(*__));
END
*/
}
// END CUT HERE