Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 6/6 3,035 MiB 0,004 s OK
#2 6/6 3,039 MiB 0,004 s OK
#3 6/6 3,070 MiB 0,004 s OK
#4 6/6 3,066 MiB 0,004 s OK
#5 6/6 3,039 MiB 0,004 s OK
#6 7/7 3,039 MiB 0,004 s OK
#7 7/7 3,102 MiB 0,004 s OK
#8 7/7 3,102 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,070 MiB 0,004 s OK
#12 7/7 3,102 MiB 0,010 s OK
#13 7/7 3,074 MiB 0,004 s OK
#14 7/7 3,109 MiB 0,022 s OK
#15 7/7 3,074 MiB 0,010 s OK

Ocenjevani program (Source.cpp):
#include <iostream>
#include <algorithm>

using namespace std;

int size[100][10];
int dpTable[100];
bool included[100];

bool jfits(int i, int j, int dim) {
	for (int x = 0; x < dim; ++x) {
		if (size[i][x] <= size[j][x]) {
			return false;
		}
	}
	return true;
}

void scan(int index, int nesting, int& dim, int& N) {
	for (int i = 0; i < N; ++i) {
		if (i == index) {
			continue;
		}
		if (!(included[i]) && jfits(index, i, dim) && dpTable[i] < nesting+1) {
			included[i] = true;
			dpTable[i] = nesting + 1;
			scan(i, nesting + 1, dim, N);
			included[i] = false;
		}
	}
}

int main() {
	int N, dim;
	cin >> N >> dim;
	int temp;
	for (int i = 0; i < N; ++i) {
		dpTable[i] = 1;
		included[i] = false;
		for (int j = 0; j < dim; ++j) {
			cin >> size[i][j];
		}
		sort(size[i], size[i] + dim);
	}

	for (int i = 0; i < N; ++i) {
		included[i] = true;
		scan(i, 1, dim, N);
		included[i] = false;
	}

	int max = 0;
	for (int i = 0; i < N; ++i) {
		if (dpTable[i] > max) {
			max = dpTable[i];
		}
	}
	cout << max << endl;

	//system("pause");
	return 0;
}