main()
{
    vector <int>a={5,6,3,9,-1};
    DerivativeSequence d;
    d.derSeq(a,1);
    return 0;
}
Ejemplo n.º 2
0
int test13() {
    vector<int> a = {51, -86, -15, -24, 69, -72, -22, 16, 55, -55, -88, 46, 15, -53, -60, -40, -82, 7, -36, 31};
    int n = 19;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {1074506};
    if(result == expected) {
        cout << "Test Case 13: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 13: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 3
0
int test48() {
    vector<int> a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
    int n = 19;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {0};
    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;
    }
}
Ejemplo n.º 4
0
int test38() {
    vector<int> a = {4, 71, 10, 9, 62, -42, -95, -82, -60, 6, -23, 8, 64, -35, -80, -18, 82, 89, 11, -60};
    int n = 0;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {4, 71, 10, 9, 62, -42, -95, -82, -60, 6, -23, 8, 64, -35, -80, -18, 82, 89, 11, -60};
    if(result == expected) {
        cout << "Test Case 38: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 38: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 5
0
int test41() {
    vector<int> a = {92, 78, 51, 24, -99, -2, -11, -94, 30, -46, -1, 31, 11, 35, -87, 36, 63, 43, 51, -47};
    int n = 0;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {92, 78, 51, 24, -99, -2, -11, -94, 30, -46, -1, 31, 11, 35, -87, 36, 63, 43, 51, -47};
    if(result == expected) {
        cout << "Test Case 41: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 41: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 6
0
int test34() {
    vector<int> a = {92, -90, 17, 7, -84, -56, 78, -41, -44, -42, -1, -59, 83, 59, 48, -88, -49, 89, -57, 39};
    int n = 18;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {6169523, -6674245};
    if(result == expected) {
        cout << "Test Case 34: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 34: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 7
0
int test36() {
    vector<int> a = {-45, -41, -90, 92, -23, 75, 51, 79, 16, 16, 29, 19};
    int n = 10;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-36636, 25776};
    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;
    }
}
Ejemplo n.º 8
0
int test19() {
    vector<int> a = {-84, 49, -13, 44, 99, 25, 97, -66, -53, 82, 75, -34, -4, -24};
    int n = 13;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-201232};
    if(result == expected) {
        cout << "Test Case 19: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 19: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 9
0
int test20() {
    vector<int> a = {-54, 14, -51, 77, -95, -73, -72, -27, -87, -3, -62, -72, -52, -81, -25, 37, 15, -43, 74, 48};
    int n = 12;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-100566, 99399, -100788, 84901, -48983, 8048, 18673, -23704};
    if(result == expected) {
        cout << "Test Case 20: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 20: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 10
0
int test17() {
    vector<int> a = {6, 79, 96, 50, 94, -56, -13, 65, -54, -72, 72, -100, 28, -33, 21, 32, -57, 46, -7, -11};
    int n = 19;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-16496406};
    if(result == expected) {
        cout << "Test Case 17: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 17: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 11
0
int test18() {
    vector<int> a = {-8, -19, 35, -16, 8, 10, 71, -9, -38, -70, 60, 79, -74, -5, -95, 65, -84, -75, 1, 0};
    int n = 13;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-148860, 143067, -113928, 38763, 86614, -230187, 346834};
    if(result == expected) {
        cout << "Test Case 18: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 18: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 12
0
int test16() {
    vector<int> a = {71, 96, -32, -12, -11, 51, -62, 92, -95, -89, -57, 44, 45, 5, -83, -6, 70, -45, 73, 78};
    int n = 19;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {13232177};
    if(result == expected) {
        cout << "Test Case 16: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 16: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 13
0
int test15() {
    vector<int> a = {87, 54, 15, 70, -20, -26, -58, -83, 97, -23, 9, 16, 92, -40};
    int n = 13;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-186443};
    if(result == expected) {
        cout << "Test Case 15: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 15: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 14
0
int test14() {
    vector<int> a = {-21, 75, 67, 80, 66, 50, 70, -13, -47, -44, 7, 71, 6, 45, 16, 70, -23, -68, -84, -17};
    int n = 19;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {3062329};
    if(result == expected) {
        cout << "Test Case 14: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 14: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 15
0
int test30() {
    vector<int> a = {-56, -9, -63, -11, 46, -22, 61, -20, 86, -13, 58, -26, 57, 46, -78, -6, 57, 7, 85, 97};
    int n = 19;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-18916817};
    if(result == expected) {
        cout << "Test Case 30: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 30: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 16
0
int test21() {
    vector<int> a = {-34, 37, -92, -3, -65, 0, 59, 23, -62, 53, -31, 32, 59};
    int n = 12;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-46486};
    if(result == expected) {
        cout << "Test Case 21: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 21: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 17
0
int test31() {
    vector<int> a = {-4, 73, 22, -39, 18, -21, 60, -83, -81, 61, 23, 92, -63, -98, -22, -12, 53};
    int n = 11;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-61031, 41675, -3640, -36921, 62637, -65772};
    if(result == expected) {
        cout << "Test Case 31: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 31: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 18
0
int test22() {
    vector<int> a = {-4, 68, -27, 88, 37, 2, 69, 8, -69, -77, -63, 46, 73, -24, 8, -76, -96, -42, -12, 77};
    int n = 18;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-817623, 452095};
    if(result == expected) {
        cout << "Test Case 22: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 22: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 19
0
int test35() {
    vector<int> a = {11, 26, 20, 81, -85, 78, 89};
    int n = 6;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-3119};
    if(result == expected) {
        cout << "Test Case 35: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 35: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 20
0
int test24() {
    vector<int> a = {-55, -60, -31, -12, -3, -8, -55, -92, 61, -87, 45, -35, 32, -97, -46, -49};
    int n = 15;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-1374708};
    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;
    }
}
Ejemplo n.º 21
0
int test37() {
    vector<int> a = {10, 25, -31, -20, -88, -42, -89, -7, -26, 86, -5, -61, 18, -63, -43, -39, -46, -51};
    int n = 9;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {12991, -14025, 15087, -15967, 14437, -7861, -2302, 10260, -11779};
    if(result == expected) {
        cout << "Test Case 37: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 37: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 22
0
int test25() {
    vector<int> a = {-45, -81, -27, 23, 65, -48, -47, 81};
    int n = 7;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-2023};
    if(result == expected) {
        cout << "Test Case 25: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 25: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 23
0
int test40() {
    vector<int> a = {14, -17, 94, -34, -14, 36, 47, -50, 61, 48, -82, 89, -93, 96, -15};
    int n = 0;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {14, -17, 94, -34, -14, 36, 47, -50, 61, 48, -82, 89, -93, 96, -15};
    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;
    }
}
Ejemplo n.º 24
0
int test26() {
    vector<int> a = {-75, 20, -29, -82, 76, 79, -11, -43, -40, 51, -7, 47, -15, -18, 0, -2, -26, 69, 65, -3};
    int n = 17;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {2536680, -2841097, 2691891};
    if(result == expected) {
        cout << "Test Case 26: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 26: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 25
0
int test46() {
    vector<int> a = {39, 29, 1, -23, 12, 4, -29, 39, 10, -19, 99, 12, -39, -16, 2};
    int n = 10;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-5965, 10849, -6951, -5769, 18632};
    if(result == expected) {
        cout << "Test Case 46: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 46: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 26
0
int test27() {
    vector<int> a = {-33, -69, -94, -60, 51, -25, -42, 59, 13, 39, -41, -98, 13, -18, -25, -98, -93};
    int n = 2;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {11, 59, 77, -187, 59, 118, -147, 72, -106, 23, 168, -142, 24, -66, 78};
    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;
    }
}
Ejemplo n.º 27
0
int test49() {
    vector<int> a = {-100, 100};
    int n = 0;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-100, 100};
    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;
    }
}
Ejemplo n.º 28
0
int test29() {
    vector<int> a = {-41, 58, -28, -100, 10, 10, -38, 14, -74, 80, -24, -8, -20, -18};
    int n = 13;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {228251};
    if(result == expected) {
        cout << "Test Case 29: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 29: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 29
0
int test12() {
    vector<int> a = {-94, 83, -100, -90, -99, 3, -97, 7, -15, -30, 74};
    int n = 10;
    DerivativeSequence* pObj = new DerivativeSequence();
    clock_t start = clock();
    vector<int> result = pObj->derSeq(a, n);
    clock_t end = clock();
    delete pObj;
    vector<int> expected = {-37681};
    if(result == expected) {
        cout << "Test Case 12: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 12: 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, int p1, bool hasAnswer, vector <int> p2) {
  cout << "Test " << testNum << ": [" << "{";
  for (int i = 0; int(p0.size()) > i; ++i) {
    if (i > 0) {
      cout << ",";
    }
    cout << p0[i];
  }
  cout << "}" << "," << p1;
  cout << "]" << endl;
  DerivativeSequence *obj;
  vector <int> answer;
  obj = new DerivativeSequence();
  clock_t startTime = clock();
  answer = obj->derSeq(p0, p1);
  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" << "{";
    for (int i = 0; int(p2.size()) > i; ++i) {
      if (i > 0) {
        cout << ",";
      }
      cout << p2[i];
    }
    cout << "}" << endl;
  }
  cout << "Your answer:" << endl;
  cout << "\t" << "{";
  for (int i = 0; int(answer.size()) > i; ++i) {
    if (i > 0) {
      cout << ",";
    }
    cout << answer[i];
  }
  cout << "}" << endl;
  if (hasAnswer) {
    if (answer.size() != p2.size()) {
      res = false;
    } else {
      for (int i = 0; int(answer.size()) > i; ++i) {
        if (answer[i] != p2[i]) {
          res = false;
        }
      }
    }
  }
  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;
}