Submission #198441

# Submission time Handle Problem Language Result Execution time Memory
198441 2020-01-26T03:38:26 Z model_code April Fools (LMIO17_faktai) C++17
100 / 100
134 ms 376 KB
#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

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 time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 256 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 8 ms 256 KB Output is correct
4 Correct 134 ms 376 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 7 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 6 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 256 KB Output is correct