Ejemplo n.º 1
0
// BEGIN CUT HERE
int main( int argc, char* argv[] ) {
    {
        int heightsARRAY[] = {1, 2, 1, 4, 3};
        vector <int> heights( heightsARRAY, heightsARRAY+ARRSIZE(heightsARRAY) );
        BuildingHeightsEasy theObject;
        eq(0, theObject.minimum(2, heights),0);
    }
    {
        int heightsARRAY[] = {1, 3, 5, 2, 1};
        vector <int> heights( heightsARRAY, heightsARRAY+ARRSIZE(heightsARRAY) );
        BuildingHeightsEasy theObject;
        eq(1, theObject.minimum(3, heights),2);
    }
    {
        int heightsARRAY[] = {43, 19, 15};
        vector <int> heights( heightsARRAY, heightsARRAY+ARRSIZE(heightsARRAY) );
        BuildingHeightsEasy theObject;
        eq(2, theObject.minimum(1, heights),0);
    }
    {
        int heightsARRAY[] = {19, 23, 9, 12};
        vector <int> heights( heightsARRAY, heightsARRAY+ARRSIZE(heightsARRAY) );
        BuildingHeightsEasy theObject;
        eq(3, theObject.minimum(3, heights),15);
    }
    {
        int heightsARRAY[] = {25, 18, 38, 1, 42, 41, 14, 16, 19, 46, 42, 39, 38, 31, 43, 37, 26, 41, 33, 37, 45, 27, 19, 24, 33, 11, 22, 20, 36, 4, 4};
        vector <int> heights( heightsARRAY, heightsARRAY+ARRSIZE(heightsARRAY) );
        BuildingHeightsEasy theObject;
        eq(4, theObject.minimum(12, heights),47);
    }
	return 0;
}
Ejemplo n.º 2
0
int main() {
    vector<int> data;
    int M;
    while(scanf("%d", &M) != EOF) {
        int n;
        scanf("%d", &n);
        for(int i = 0; i < n; i ++) {
            int x;
            scanf("%d", &x);
            data.push_back(x);
        }
        BuildingHeightsEasy solve;
        cout <<  solve.minimum(M, data);
    }
    return 0;
}
Ejemplo n.º 3
0
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, int p0, vector <int> p1, bool hasAnswer, int p2) {
    cout << "Test " << testNum << ": [" << p0 << "," << "{";
    for (int i = 0; int(p1.size()) > i; ++i) {
        if (i > 0) {
            cout << ",";
        }
        cout << p1[i];
    }
    cout << "}";
    cout << "]" << endl;
    BuildingHeightsEasy *obj;
    int answer;
    obj = new BuildingHeightsEasy();
    clock_t startTime = clock();
    answer = obj->minimum(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" << p2 << endl;
    }
    cout << "Your answer:" << endl;
    cout << "\t" << answer << endl;
    if (hasAnswer) {
        res = answer == p2;
    }
    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;
}
Ejemplo n.º 4
0
int main(){
  BuildingHeightsEasy b;
  V(v0, 1, 2, 1, 4, 3);
  P(b.minimum(2, v0));

  V(v1, 1, 3, 5, 2, 1);
  P(b.minimum(3, v1));

  V(v2, 43, 19, 15);
  P(b.minimum(1, v2));

  V(v3, 19, 23, 9, 12);
  P(b.minimum(3, v3));

  V(v4, 25, 18, 38, 1, 42, 41, 14, 16, 19, 46, 42, 39, 38, 31, 43, 37, 26, 41, 33, 37, 45, 27, 19, 24, 33, 11, 22, 20, 36, 4, 4);
  P(b.minimum(12, v4));
}