Rezultati

Up. imeNalogaJezikRezultatČas oddaje
mmj-2017 Škatle C++ 100/100OK 20. apr '17 @ 18:33

Test Točke Porabljen spomin Porabljen čas Status
#1 6/6 3,070 MiB 0,004 s OK
#2 6/6 3,105 MiB 0,004 s OK
#3 6/6 3,102 MiB 0,004 s OK
#4 6/6 3,070 MiB 0,004 s OK
#5 6/6 3,070 MiB 0,004 s OK
#6 7/7 3,070 MiB 0,004 s OK
#7 7/7 3,066 MiB 0,004 s OK
#8 7/7 3,098 MiB 0,004 s OK
#9 7/7 3,066 MiB 0,004 s OK
#10 7/7 3,102 MiB 0,004 s OK
#11 7/7 3,063 MiB 0,004 s OK
#12 7/7 3,074 MiB 0,004 s OK
#13 7/7 3,074 MiB 0,004 s OK
#14 7/7 3,070 MiB 0,004 s OK
#15 7/7 3,074 MiB 0,004 s OK

Ocenjevani program (main.cpp):
#include <iostream>
#include <algorithm>
#include <stdlib.h>

using namespace std;

int* sk[100];
int bst[100];
int a,b;

bool cmp(int *ab, int *bb){
    return ab[0] < bb[0];
}

bool goesin(int i, int j){
    for (int k = 0; k < b; k++){
        if (sk[i][k] >= sk[j][k]) return false;
    }
    return true;
}

int rek(int e){
    if (bst[e] != -1) return bst[e];
    int rez = 1;
    for (int i = e + 1; i < a; i++){
        if (goesin(e,i)){
            rez = max(1+rek(i),rez);
        }
    }
    bst[e] = rez;
    return rez;
}

int main()
{
    int c,d,e;
    cin >> a >> b;
    for (int i=0;i<a;i++){
        bst[i] = -1;
        sk[i] = (int*)malloc(b*sizeof(int));
        for (int j=0;j<b;j++){
            cin >> sk[i][j];
        }
        sort(sk[i],sk[i]+b);
    }
    sort(sk,sk+a,cmp);
 /*   for (int i=0;i<a;i++){
        for (int j=0;j<b;j++){
            cout << sk[i][j] << " ";
        }
        cout << endl;
    }*/
    int bstt = 1;
    for (int i = 0; i < a; i++){
        bstt = max(bstt,rek(i));
    }
    cout << bstt;
    return 0;
}