Submission #198441

#TimeUsernameProblemLanguageResultExecution timeMemory
198441model_codeApril Fools (LMIO17_faktai)C++17
100 / 100
134 ms376 KiB
#include <cstdio>
#include <algorithm>

using namespace std;

int i, j, N, k, l[1001], x, m = 21, d = -1, f;

int main() {
	scanf("%d%d", &N, &x);
	for (i = 0; i < N; i++) {
		scanf("%d", &k);
		l[i] = 0;
		for (j = 0; j < k; j++) {
			scanf("%d", &f);
			l[i] |= (1 << (f - 1));
		}
	}
	for (j = 1; j < (1 << x); j++) {
		for (i = 0; i < N; i++) {
			k = j & l[i];
			if (!k || (k & (k - 1))) break;
		}
		if (i < N) continue;
		k = 0;
		for (i = 1; i < (1 << x); i*=2) if (j&i) k++;
		if (k > d) d = k;
		if (k < m) m = k;
	}
	printf("%d %d\n", m, d);
}

Compilation message (stderr)

faktai.cpp: In function 'int main()':
faktai.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &x);
  ~~~~~^~~~~~~~~~~~~~~~
faktai.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &k);
   ~~~~~^~~~~~~~~~
faktai.cpp:14:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &f);
    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...