Submission #205754

# Submission time Handle Problem Language Result Execution time Memory
205754 2020-02-29T18:05:13 Z ly20 Political Development (BOI17_politicaldevelopment) C++17
16 / 100
183 ms 146424 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5123;
int grau[MAXN];
int tb[MAXN][MAXN];
int sq = sqrt(MAXN);
vector < int > ind;
vector <int> grafo[MAXN];
int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	int resp = 1;
	for(int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a); grau[i] = a;
		if(a > 0) resp = 2;
		if(a > sq) ind.push_back(i);
		for(int j = 0; j < a; j++) {
			int b;
			scanf("%d", &b);
			tb[i][b] = 1;
			grafo[i].push_back(b);
		}
	}
	for(int i = 0; i < n; i++) {
		if(grau[i] <= sq) {
			for(int j = 0; j < grafo[i].size(); j++) {
				for(int k = j + 1; k < grafo[i].size(); k++) {
					if(tb[grafo[i][j]][grafo[i][k]] == 1) resp = 3;
				}
			}
		}
	}
	for(int i = 0; i < ind.size(); i++) {
		for(int j = i + 1; j < ind.size(); j++) {
			for(int k = j + 1; k < ind.size(); k++) {
				if(tb[ind[i]][ind[j]] == 1 && tb[ind[j]][ind[k]] == 1 && tb[ind[k]][ind[i]] == 1) resp = 3;
			}
		}
	}
	printf("%d\n", resp);
	return 0;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:27:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j = 0; j < grafo[i].size(); j++) {
                   ~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:28:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int k = j + 1; k < grafo[i].size(); k++) {
                        ~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:34:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < ind.size(); i++) {
                 ~~^~~~~~~~~~~~
politicaldevelopment.cpp:35:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = i + 1; j < ind.size(); j++) {
                      ~~^~~~~~~~~~~~
politicaldevelopment.cpp:36:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k = j + 1; k < ind.size(); k++) {
                       ~~^~~~~~~~~~~~
politicaldevelopment.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a); grau[i] = a;
   ~~~~~^~~~~~~~~~
politicaldevelopment.cpp:20:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &b);
    ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 508 KB Output is correct
3 Correct 26 ms 34424 KB Output is correct
4 Correct 17 ms 20856 KB Output is correct
5 Correct 17 ms 20856 KB Output is correct
6 Correct 25 ms 22008 KB Output is correct
7 Correct 26 ms 22136 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 508 KB Output is correct
3 Correct 26 ms 34424 KB Output is correct
4 Correct 17 ms 20856 KB Output is correct
5 Correct 17 ms 20856 KB Output is correct
6 Correct 25 ms 22008 KB Output is correct
7 Correct 26 ms 22136 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 18 ms 20904 KB Output is correct
12 Correct 17 ms 20856 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 19 ms 20856 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 25 ms 22136 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 27 ms 22264 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 17 ms 20728 KB Output is correct
21 Correct 16 ms 20728 KB Output is correct
22 Correct 5 ms 504 KB Output is correct
23 Correct 32 ms 41208 KB Output is correct
24 Correct 5 ms 504 KB Output is correct
25 Correct 32 ms 41720 KB Output is correct
26 Correct 29 ms 38136 KB Output is correct
27 Correct 28 ms 36600 KB Output is correct
28 Correct 30 ms 38008 KB Output is correct
29 Correct 30 ms 36856 KB Output is correct
30 Correct 27 ms 35960 KB Output is correct
31 Correct 33 ms 44536 KB Output is correct
32 Correct 27 ms 35832 KB Output is correct
33 Correct 33 ms 44408 KB Output is correct
34 Correct 33 ms 44024 KB Output is correct
35 Correct 17 ms 19576 KB Output is correct
36 Correct 19 ms 19448 KB Output is correct
37 Correct 17 ms 19576 KB Output is correct
38 Correct 10 ms 7672 KB Output is correct
39 Correct 11 ms 7800 KB Output is correct
40 Correct 43 ms 55416 KB Output is correct
41 Correct 11 ms 7672 KB Output is correct
42 Correct 41 ms 55160 KB Output is correct
43 Correct 41 ms 55160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Incorrect 5 ms 508 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 508 KB Output is correct
3 Correct 26 ms 34424 KB Output is correct
4 Correct 17 ms 20856 KB Output is correct
5 Correct 17 ms 20856 KB Output is correct
6 Correct 25 ms 22008 KB Output is correct
7 Correct 26 ms 22136 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 18 ms 20904 KB Output is correct
12 Correct 17 ms 20856 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 19 ms 20856 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 25 ms 22136 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 27 ms 22264 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 17 ms 20728 KB Output is correct
21 Correct 16 ms 20728 KB Output is correct
22 Correct 5 ms 504 KB Output is correct
23 Correct 32 ms 41208 KB Output is correct
24 Correct 5 ms 504 KB Output is correct
25 Correct 32 ms 41720 KB Output is correct
26 Correct 29 ms 38136 KB Output is correct
27 Correct 28 ms 36600 KB Output is correct
28 Correct 30 ms 38008 KB Output is correct
29 Correct 30 ms 36856 KB Output is correct
30 Correct 27 ms 35960 KB Output is correct
31 Correct 33 ms 44536 KB Output is correct
32 Correct 27 ms 35832 KB Output is correct
33 Correct 33 ms 44408 KB Output is correct
34 Correct 33 ms 44024 KB Output is correct
35 Correct 17 ms 19576 KB Output is correct
36 Correct 19 ms 19448 KB Output is correct
37 Correct 17 ms 19576 KB Output is correct
38 Correct 10 ms 7672 KB Output is correct
39 Correct 11 ms 7800 KB Output is correct
40 Correct 43 ms 55416 KB Output is correct
41 Correct 11 ms 7672 KB Output is correct
42 Correct 41 ms 55160 KB Output is correct
43 Correct 41 ms 55160 KB Output is correct
44 Incorrect 57 ms 83960 KB Output isn't correct
45 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 508 KB Output is correct
3 Correct 26 ms 34424 KB Output is correct
4 Correct 17 ms 20856 KB Output is correct
5 Correct 17 ms 20856 KB Output is correct
6 Correct 25 ms 22008 KB Output is correct
7 Correct 26 ms 22136 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 18 ms 20904 KB Output is correct
12 Correct 17 ms 20856 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 19 ms 20856 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 25 ms 22136 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 27 ms 22264 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 17 ms 20728 KB Output is correct
21 Correct 16 ms 20728 KB Output is correct
22 Correct 5 ms 504 KB Output is correct
23 Correct 32 ms 41208 KB Output is correct
24 Correct 5 ms 504 KB Output is correct
25 Correct 32 ms 41720 KB Output is correct
26 Correct 29 ms 38136 KB Output is correct
27 Correct 28 ms 36600 KB Output is correct
28 Correct 30 ms 38008 KB Output is correct
29 Correct 30 ms 36856 KB Output is correct
30 Correct 27 ms 35960 KB Output is correct
31 Correct 33 ms 44536 KB Output is correct
32 Correct 27 ms 35832 KB Output is correct
33 Correct 33 ms 44408 KB Output is correct
34 Correct 33 ms 44024 KB Output is correct
35 Correct 17 ms 19576 KB Output is correct
36 Correct 19 ms 19448 KB Output is correct
37 Correct 17 ms 19576 KB Output is correct
38 Correct 10 ms 7672 KB Output is correct
39 Correct 11 ms 7800 KB Output is correct
40 Correct 43 ms 55416 KB Output is correct
41 Correct 11 ms 7672 KB Output is correct
42 Correct 41 ms 55160 KB Output is correct
43 Correct 41 ms 55160 KB Output is correct
44 Correct 5 ms 504 KB Output is correct
45 Runtime error 183 ms 146424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
46 Halted 0 ms 0 KB -