Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 6/6 3,305 MiB 0,004 s OK
#2 6/6 3,336 MiB 0,004 s OK
#3 6/6 3,305 MiB 0,004 s OK
#4 6/6 3,301 MiB 0,004 s OK
#5 6/6 3,336 MiB 0,004 s OK
#6 7/7 3,336 MiB 0,004 s OK
#7 7/7 3,336 MiB 0,004 s OK
#8 7/7 3,336 MiB 0,004 s OK
#9 7/7 3,328 MiB 0,004 s OK
#10 7/7 3,305 MiB 0,004 s OK
#11 7/7 3,336 MiB 0,004 s OK
#12 7/7 3,309 MiB 0,004 s OK
#13 7/7 3,313 MiB 0,004 s OK
#14 7/7 3,344 MiB 0,004 s OK
#15 7/7 3,309 MiB 0,010 s OK

Ocenjevani program (Skatle.cpp):
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 3111

vector<int> v[maxn];
int dp[maxn];
int n, d;


bool check(int i, int j){
    for(int k = 0; k < d; k++)
        if(v[i][k] <= v[j][k])
            return 0;
    return 1;
}

int main(){
   int ans = 0;
   scanf("%d%d", &n, &d);
   for(int i = 0; i < n; i++){
       for(int j = 0; j < d; j++){
            int a;
            scanf("%d", &a);
            v[i].push_back(a);
        }
        sort(v[i].begin(), v[i].end());
    }   
    sort(v, v + n);
    
    for(int i = 0; i < n; i++){
        int cur = 0;
        for(int j = 0; j < i; j++){
            bool b = check(i, j);
            if(b)
                cur = max(cur, dp[j]);
        }
        dp[i] = cur + 1;
        ans = max(ans, dp[i]);
    }
    printf("%d", ans);
    return 0;
}