Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 6/6 3,055 MiB 0,004 s OK
#2 6/6 3,133 MiB 0,004 s OK
#3 6/6 3,133 MiB 0,004 s OK
#4 6/6 3,133 MiB 0,004 s OK
#5 6/6 3,055 MiB 0,004 s OK
#6 7/7 3,129 MiB 0,004 s OK
#7 7/7 3,137 MiB 0,004 s OK
#8 7/7 3,063 MiB 0,004 s OK
#9 7/7 3,133 MiB 0,004 s OK
#10 7/7 3,137 MiB 0,004 s OK
#11 7/7 3,129 MiB 0,004 s OK
#12 7/7 3,137 MiB 0,010 s OK
#13 7/7 3,066 MiB 0,010 s OK
#14 7/7 3,070 MiB 0,004 s OK
#15 7/7 3,141 MiB 0,010 s OK

Ocenjevani program (skatle.cpp):
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

bool so(vector<int> a, vector<int> b) {
    for(int i=0; i<a.size(); ++i) {
        if(a[i] > b[i]) return true;
        if(a[i] < b[i]) return false;
    }
    return true;
}

int main() {
    int n, d;
    cin >> n >> d;
    vector< vector<int> > skatle(n, vector<int>(d, 0));
    for(int i=0; i<n; ++i) {
        for(int j=0; j<d; ++j) {
            int a;
            cin >> a;
            skatle[i][j] = a;
        }
        sort(skatle[i].begin(), skatle[i].end());
    }
    sort(skatle.begin(), skatle.end(), so);
    
    /*for(int i=0; i<n; ++i) {
        for(int j=0; j<d; ++j) {
            cout << skatle[i][j] << ' ';
        }
        cout << endl;
    }*/
    
    vector<int> rez(n, 0);
    rez[0] = 1;
    int absmaks = 1;
    for(int i=1; i<n; ++i) {
        int maks = 1;
        //cout << "zacenjam\n";
        for(int j=0; j<i; ++j) {
            bool f = true;
            //cout << "++++++++++++++++++++++++ " << j << endl;
            for(int k=0; k<d; ++k) {
                if(skatle[i][k] >= skatle[j][k]) {
                    //cout << "lalal\n";
                    f=false;
                    break;
                }
            }
            if(f) {
                maks = max(maks, rez[j] + 1);
            }
        }
        rez[i] = maks;
        absmaks = max(absmaks, maks);
        
        //for(int j=0; j<n; ++j) cout << rez[j] << ' ';
        //cout << endl;
    }
    cout << absmaks << endl;
    
    return 0;
}