Esempio n. 1
0
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <int> p0, string p1, vector <int> p2, bool hasAnswer, int p3) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << p0[i];
	}
	cout << "}" << "," << "\"" << p1 << "\"" << "," << "{";
	for (int i = 0; int(p2.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << p2[i];
	}
	cout << "}";
	cout << "]" << endl;
	ICPCBalloons *obj;
	int answer;
	obj = new ICPCBalloons();
	clock_t startTime = clock();
	answer = obj->minRepaintings(p0, p1, p2);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p3 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p3;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
Esempio n. 2
0
int main( int argc, char* argv[] ) {
  
    {
        int balloonCountARRAY[] = {100};
        vector <int> balloonCount( balloonCountARRAY, balloonCountARRAY+ARRSIZE(balloonCountARRAY) );
        int maxAcceptedARRAY[] = {1,2,3,4,5};
        vector <int> maxAccepted( maxAcceptedARRAY, maxAcceptedARRAY+ARRSIZE(maxAcceptedARRAY) );
        ICPCBalloons theObject;
        eq(0, theObject.minRepaintings(balloonCount, "L", maxAccepted),10);
    }
    
    {
        int balloonCountARRAY[] = {100};
        vector <int> balloonCount( balloonCountARRAY, balloonCountARRAY+ARRSIZE(balloonCountARRAY) );
        int maxAcceptedARRAY[] = {10,20,30,40,50};
        vector <int> maxAccepted( maxAcceptedARRAY, maxAcceptedARRAY+ARRSIZE(maxAcceptedARRAY) );
        ICPCBalloons theObject;
        eq(1, theObject.minRepaintings(balloonCount, "M", maxAccepted),-1);
    }
    
    {
        int balloonCountARRAY[] = {5,6,1,5,6,1,5,6,1};
        vector <int> balloonCount( balloonCountARRAY, balloonCountARRAY+ARRSIZE(balloonCountARRAY) );
        int maxAcceptedARRAY[] = {7,7,4,4,7,7};
        vector <int> maxAccepted( maxAcceptedARRAY, maxAcceptedARRAY+ARRSIZE(maxAcceptedARRAY) );
        ICPCBalloons theObject;
        eq(2, theObject.minRepaintings(balloonCount, "MLMMLMMLM", maxAccepted),6);
    }
    
    {
        int balloonCountARRAY[] = {100,100};
        vector <int> balloonCount( balloonCountARRAY, balloonCountARRAY+ARRSIZE(balloonCountARRAY) );
        int maxAcceptedARRAY[] = {50,51,51};
        vector <int> maxAccepted( maxAcceptedARRAY, maxAcceptedARRAY+ARRSIZE(maxAcceptedARRAY) );
        ICPCBalloons theObject;
        eq(3, theObject.minRepaintings(balloonCount, "ML", maxAccepted),-1);
    }
    {
        int balloonCountARRAY[] = {8,5,1,4,1,1,3,1,3,3,5,4,5,6,9};
        vector <int> balloonCount( balloonCountARRAY, balloonCountARRAY+ARRSIZE(balloonCountARRAY) );
        int maxAcceptedARRAY[] = {3,5,3,3,5,6,4,6,4,2,3,7,1,5,2};
        vector <int> maxAccepted( maxAcceptedARRAY, maxAcceptedARRAY+ARRSIZE(maxAcceptedARRAY) );
        ICPCBalloons theObject;
        eq(4, theObject.minRepaintings(balloonCount, "MMMLLLMMLLMLMLM", maxAccepted),5);
    }
    {
        int balloonCountARRAY[] = {1,18,4,7,19,7,7,1,4,8,10,5,14,13,8,22,6,3,13,5,3,4,2,1,3,15,19,4,5,9,4,11,2,7,12,20,11,26,22,7,2,10,9,20,13,20,2,9,11,9};
        vector <int> balloonCount( balloonCountARRAY, balloonCountARRAY+ARRSIZE(balloonCountARRAY) );
        int maxAcceptedARRAY[] = {44,59,29,53,16,23,13,14,29,42,13,15,66,4,47};
        vector <int> maxAccepted( maxAcceptedARRAY, maxAcceptedARRAY+ARRSIZE(maxAcceptedARRAY) );
        ICPCBalloons theObject;
        eq(5, theObject.minRepaintings(balloonCount, "LLMLLLLMLLLLLLLLLLLLMLLLLLLLLLLMMLMLLLMLLLLLLLLMLL", maxAccepted),210);
    }
    
  return 0;
}