Exemple #1
0
int main()
{
    PointErasingTwo a;
    int myints[] = { 1, 2, 1, 1, 0, 4, 3 };
    vector<int> y (myints, myints + sizeof(myints) / sizeof(int) );
    cout<<a.getMaximum(y);
    return 0;
}
Exemple #2
0
int test51() {
    vector<int> y = {44, 2, 31, 49, 44, 48, 44, 45, 16, 45, 46, 48, 45, 42, 31, 47, 49, 33, 18, 44, 50, 45, 44, 44, 23, 41, 7, 37, 34, 48, 44, 46, 47, 37, 44, 45, 23, 9, 47, 48, 49, 46, 44, 49};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 37;
    if(result == expected) {
        cout << "Test Case 51: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 51: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #3
0
int test50() {
    vector<int> y = {11, 17, 27, 38, 3, 23, 20, 30, 3, 42, 41, 8, 10, 23, 16, 45, 27, 38, 30, 43, 39, 19, 18, 3, 46, 23, 40, 23, 23, 50};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 23;
    if(result == expected) {
        cout << "Test Case 50: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 50: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #4
0
int test3() {
    vector<int> y = {10, 19, 10, 19};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 0;
    if(result == expected) {
        cout << "Test Case 3: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 3: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #5
0
int test49() {
    vector<int> y = {5, 18, 11, 20, 40, 8, 40, 0, 37, 20, 31, 29, 7, 4, 20, 24, 20, 7, 31, 6, 9, 15, 28, 18, 49, 6, 28, 22, 17, 18, 8, 9, 14, 3, 10, 13, 18, 7, 14, 18, 7, 42, 20, 20, 23};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 36;
    if(result == expected) {
        cout << "Test Case 49: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 49: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #6
0
int test57() {
    vector<int> y = {34, 50, 32, 29, 22, 50, 23, 20, 30, 22, 15, 24, 23, 33, 2, 19, 33, 45, 19, 14, 35, 20, 31, 20, 20, 43, 22, 18};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 21;
    if(result == expected) {
        cout << "Test Case 57: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 57: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #7
0
int test56() {
    vector<int> y = {3, 50, 10, 5, 35, 31, 11, 49, 49, 9, 44, 18, 9, 16, 26, 41, 33, 4, 15, 20, 10, 18, 6, 8, 21, 13, 46, 9, 32, 11, 8, 15, 10, 22, 23};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 24;
    if(result == expected) {
        cout << "Test Case 56: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 56: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #8
0
int test54() {
    vector<int> y = {12, 3, 17, 40, 12, 11, 12, 12, 41, 12, 0, 10, 11, 38, 11, 24, 11, 11, 12, 11, 26, 12, 28, 11, 12, 11};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 16;
    if(result == expected) {
        cout << "Test Case 54: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 54: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #9
0
int test42() {
    vector<int> y = {39, 29, 22, 37, 43, 27, 43, 35, 48, 43, 35, 25, 25, 15, 11, 18, 15, 41, 43, 29, 48, 43, 25, 43, 39, 25, 27, 43, 18, 40, 48, 36, 41, 43, 40, 18, 48, 11, 3, 18, 40, 22, 37, 35};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 26;
    if(result == expected) {
        cout << "Test Case 42: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 42: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #10
0
int test40() {
    vector<int> y = {39, 17, 11, 17, 23, 21, 4, 17, 16, 14, 4, 17, 14, 0, 14, 12, 39, 39, 16, 17, 41, 21, 39, 16, 50, 10, 4, 12, 21, 28, 12, 28, 12, 41, 14, 12, 17, 21, 35, 21, 21, 23, 4, 23, 14, 0, 28, 50, 28, 0};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 39;
    if(result == expected) {
        cout << "Test Case 40: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 40: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #11
0
int test36() {
    vector<int> y = {3, 27, 13, 45, 13, 45, 3, 27, 24, 25, 27, 24, 34, 24, 13, 45, 3, 45, 47, 45, 24, 24, 3, 34, 47, 3, 25, 47, 25, 34, 3, 24, 13, 25, 45, 3, 34, 45, 47, 3, 3, 13, 25, 13, 47, 13, 27, 34, 27, 13};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 31;
    if(result == expected) {
        cout << "Test Case 36: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 36: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #12
0
int test27() {
    vector<int> y = {5, 1, 3, 15, 11, 10, 14, 0, 6, 6, 12, 4, 0, 11, 7, 0, 14, 11, 7, 5, 9, 15, 8, 12, 1, 5, 14, 16, 9, 3, 8, 6, 2, 1, 16, 15, 2, 13, 7, 13, 10, 13, 4, 4, 8, 9, 2, 10, 3, 12};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 31;
    if(result == expected) {
        cout << "Test Case 27: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 27: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #13
0
int test24() {
    vector<int> y = {13, 9, 15, 3, 13, 17, 23, 16, 7, 14, 0, 12, 19, 14, 15, 16, 5, 20, 11, 18, 24, 6, 23, 7, 2, 8, 12, 4, 0, 10, 20, 2, 17, 6, 10, 18, 22, 24, 21, 1, 21, 1, 4, 5, 22, 11, 9, 3, 8, 19};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 31;
    if(result == expected) {
        cout << "Test Case 24: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 24: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #14
0
int test60() {
    vector<int> y = {0, 1, 2, 23, 12, 0, 34, 9, 8, 7, 5, 3, 2, 1, 12, 32, 5, 6, 8, 37};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 17;
    if(result == expected) {
        cout << "Test Case 60: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 60: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #15
0
int test52() {
    vector<int> y = {39, 18, 38, 8, 30, 39, 27, 12, 11, 18, 23, 47, 17, 6, 26, 39, 18, 33, 30, 32, 19, 16, 24, 25, 41, 12, 29, 12, 12, 20, 8, 29, 48, 3, 28, 24, 26, 31, 3, 36, 44, 10, 3, 40, 31, 50, 50, 3};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 36;
    if(result == expected) {
        cout << "Test Case 52: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 52: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #16
0
int test53() {
    vector<int> y = {34, 40, 36, 17, 8, 23, 3, 24, 24, 31, 48, 15, 0, 17, 20, 22, 26, 26, 22, 13, 24, 12, 10, 23, 31, 31, 35, 16, 22, 33, 32, 2, 19, 38, 30, 13, 15, 27, 44, 37, 6, 26, 30, 1, 15};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 38;
    if(result == expected) {
        cout << "Test Case 53: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 53: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #17
0
int test43() {
    vector<int> y = {22, 19, 21, 25, 22, 16, 48, 21, 7, 20, 32, 39, 48, 7, 21, 39, 7, 38, 19, 39, 20, 39, 20, 19, 39, 10, 10, 25, 10, 16, 38, 12, 27, 25, 48, 48, 12, 25, 25, 11};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 23;
    if(result == expected) {
        cout << "Test Case 43: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 43: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #18
0
int test55() {
    vector<int> y = {19, 11, 19, 7, 38, 9, 19, 19, 42, 19, 26, 14, 15, 19, 31, 19, 19, 19, 19, 24, 19, 17, 17, 19, 19, 12, 20, 19, 11, 45, 19, 19, 19, 19, 31, 19, 19, 8, 19, 10, 31, 19, 19, 19, 4, 39, 19, 19, 36, 19};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 39;
    if(result == expected) {
        cout << "Test Case 55: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 55: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #19
0
int test47() {
    vector<int> y = {50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 48;
    if(result == expected) {
        cout << "Test Case 47: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 47: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Exemple #20
0
int test48() {
    vector<int> y = {6, 5, 25, 47, 0, 23, 26, 9, 49, 17, 20, 16, 15, 34, 25, 14, 12, 23, 38, 30, 17, 24, 43, 38, 13, 16, 24, 33, 27, 24, 16, 26, 23, 15, 7, 14, 35, 16, 38, 20, 31, 27, 19, 12, 19, 30};
    PointErasingTwo* pObj = new PointErasingTwo();
    clock_t start = clock();
    int result = pObj->getMaximum(y);
    clock_t end = clock();
    delete pObj;
    int expected = 34;
    if(result == expected) {
        cout << "Test Case 48: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 48: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <int> p0, bool hasAnswer, int p1) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << p0[i];
	}
	cout << "}";
	cout << "]" << endl;
	PointErasingTwo *obj;
	int answer;
	obj = new PointErasingTwo();
	clock_t startTime = clock();
	answer = obj->getMaximum(p0);
	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" << p1 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p1;
	}
	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;
}