Artifact Content
Not logged in

Artifact ba2c28c303f93ceec445437f506c6684e541d78b


#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 SRMCodingPhase { public:
	int countScore(vector <int> points, vector <int> skills, int luck)
	{
		const int dec[] = {2,4,8};

		int pBest = 0;

		int i[3];
		for(i[0]=0; i[0]<skills[0] && i[0]<=luck; ++i[0])
		for(i[1]=0; i[1]<skills[1] && i[0]+i[1]<=luck; ++i[1])
		for(i[2]=0; i[2]<skills[2] && i[0]+i[1]+i[2]<=luck; ++i[2])
		{
			int a[3];
			for(a[0]=0; a[0]<2; ++a[0])
			for(a[1]=0; a[1]<2; ++a[1])
			for(a[2]=0; a[2]<2; ++a[2])
			{
				int p = 0, t = 0;
				for(int x=0; x<3; ++x)
					if( a[x] ) {
						p += points[x] - dec[x]*(skills[x]-i[x]);
						t += skills[x]-i[x];
					}
				if( t <= 75 )
					pBest = max(pBest, p);
			}
		}
		return pBest;
	}
};

// 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(_, SRMCodingPhase().countScore(points, skills, luck));}
int main(){

CASE(0)
	int points_[] = {250, 500, 1000};
	  vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_)); 
	int skills_[] = {10, 25, 40};
	  vector <int> skills(skills_, skills_+sizeof(skills_)/sizeof(*skills_)); 
	int luck = 0; 
	int _ = 1310; 
END
CASE(1)
	int points_[] = {300, 600, 900};
	  vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_)); 
	int skills_[] = {30, 65, 90};
	  vector <int> skills(skills_, skills_+sizeof(skills_)/sizeof(*skills_)); 
	int luck = 25; 
	int _ = 680; 
END
CASE(2)
	int points_[] = {250, 550, 950};
	  vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_)); 
	int skills_[] = {10, 25, 40};
	  vector <int> skills(skills_, skills_+sizeof(skills_)/sizeof(*skills_)); 
	int luck = 75; 
	int _ = 1736; 
END
CASE(3)
	int points_[] = {256, 512, 1024};
	  vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_)); 
	int skills_[] = {35, 30, 25};
	  vector <int> skills(skills_, skills_+sizeof(skills_)/sizeof(*skills_)); 
	int luck = 0; 
	int _ = 1216; 
END
CASE(4)
	int points_[] = {300, 600, 1100};
	  vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_)); 
	int skills_[] = {80, 90, 100};
	  vector <int> skills(skills_, skills_+sizeof(skills_)/sizeof(*skills_)); 
	int luck = 4; 
	int _ = 0; 
END
CASE(5)
int points_[] = {300,600,1100};
	  vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_)); 
	  int skills_[] = {30,30,30};
	  vector <int> skills(skills_, skills_+sizeof(skills_)/sizeof(*skills_)); 
	int luck = 100; 
	int _ = -1; 
END
/*
CASE(6)
	int points_[] = ;
	  vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_)); 
	int skills_[] = ;
	  vector <int> skills(skills_, skills_+sizeof(skills_)/sizeof(*skills_)); 
	int luck = ; 
	int _ = ; 
END
*/
}
// END CUT HERE