Submission #971522

# Submission time Handle Problem Language Result Execution time Memory
971522 2024-04-28T18:00:28 Z gutzzy Political Development (BOI17_politicaldevelopment) C++14
54 / 100
3000 ms 10116 KB
#include <bits/stdc++.h>
using namespace std;
//#define int unsigned short
int n,k,d,a;
int ans = 0;
vector<vector<int>> ady;
vector<vector<int>> adyd;

void dfs(int nodo, int sz, vector<int> c){
    ans = max(ans,sz);
    for(int x:adyd[nodo]) c[x]++;
    for(int x:adyd[nodo]){
        if(c[x]>=sz) dfs(x,sz+1,c); // todos los nodos "anteriores" están conectados
    }
    for(int x:adyd[nodo]) c[x]--;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> k;
    ady = vector<vector<int>>(n,vector<int>());
    adyd = vector<vector<int>>(n,vector<int>());
    vector<int> deg(n);
    for(int i=0;i<n;i++){
        cin >> d;
        deg[i] = d;
        for(int j=0;j<d;j++){
            cin >> a;
            ady[i].push_back(a);
        }
    }
    
    // paso a dirigido
    for(int i=0;i<n;i++){
        for(int vec:ady[i]){
            if(deg[i]<deg[vec] or (deg[i]==deg[vec] and i<vec)) adyd[i].push_back(vec);
        }
    }
    
    vector<int> c(n,0);
    for(int i=0;i<n;i++){
        dfs(i, 1, c);
    }
    
    cout << ans << endl;
    
    
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 8 ms 1076 KB Output is correct
4 Correct 7 ms 860 KB Output is correct
5 Correct 8 ms 1108 KB Output is correct
6 Correct 6 ms 1116 KB Output is correct
7 Correct 7 ms 1116 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 8 ms 1076 KB Output is correct
4 Correct 7 ms 860 KB Output is correct
5 Correct 8 ms 1108 KB Output is correct
6 Correct 6 ms 1116 KB Output is correct
7 Correct 7 ms 1116 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 768 KB Output is correct
11 Correct 6 ms 860 KB Output is correct
12 Correct 6 ms 860 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 6 ms 860 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 7 ms 1272 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 6 ms 1116 KB Output is correct
19 Correct 3 ms 604 KB Output is correct
20 Correct 5 ms 860 KB Output is correct
21 Correct 5 ms 860 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 8 ms 860 KB Output is correct
24 Correct 3 ms 604 KB Output is correct
25 Correct 8 ms 860 KB Output is correct
26 Correct 7 ms 860 KB Output is correct
27 Correct 7 ms 1032 KB Output is correct
28 Correct 7 ms 860 KB Output is correct
29 Correct 7 ms 1112 KB Output is correct
30 Correct 8 ms 1112 KB Output is correct
31 Correct 8 ms 1060 KB Output is correct
32 Correct 8 ms 1092 KB Output is correct
33 Correct 8 ms 860 KB Output is correct
34 Correct 8 ms 860 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 600 KB Output is correct
37 Correct 2 ms 604 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 1 ms 604 KB Output is correct
40 Correct 10 ms 1132 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 10 ms 1112 KB Output is correct
43 Correct 10 ms 1368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 3049 ms 10116 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 8 ms 1076 KB Output is correct
4 Correct 7 ms 860 KB Output is correct
5 Correct 8 ms 1108 KB Output is correct
6 Correct 6 ms 1116 KB Output is correct
7 Correct 7 ms 1116 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 768 KB Output is correct
11 Correct 6 ms 860 KB Output is correct
12 Correct 6 ms 860 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 6 ms 860 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 7 ms 1272 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 6 ms 1116 KB Output is correct
19 Correct 3 ms 604 KB Output is correct
20 Correct 5 ms 860 KB Output is correct
21 Correct 5 ms 860 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 8 ms 860 KB Output is correct
24 Correct 3 ms 604 KB Output is correct
25 Correct 8 ms 860 KB Output is correct
26 Correct 7 ms 860 KB Output is correct
27 Correct 7 ms 1032 KB Output is correct
28 Correct 7 ms 860 KB Output is correct
29 Correct 7 ms 1112 KB Output is correct
30 Correct 8 ms 1112 KB Output is correct
31 Correct 8 ms 1060 KB Output is correct
32 Correct 8 ms 1092 KB Output is correct
33 Correct 8 ms 860 KB Output is correct
34 Correct 8 ms 860 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 600 KB Output is correct
37 Correct 2 ms 604 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 1 ms 604 KB Output is correct
40 Correct 10 ms 1132 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 10 ms 1112 KB Output is correct
43 Correct 10 ms 1368 KB Output is correct
44 Correct 229 ms 1576 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 10 ms 1116 KB Output is correct
47 Correct 17 ms 1116 KB Output is correct
48 Correct 10 ms 1116 KB Output is correct
49 Correct 17 ms 1300 KB Output is correct
50 Correct 17 ms 1116 KB Output is correct
51 Correct 37 ms 1676 KB Output is correct
52 Correct 7 ms 860 KB Output is correct
53 Correct 31 ms 1764 KB Output is correct
54 Correct 38 ms 1792 KB Output is correct
55 Correct 8 ms 860 KB Output is correct
56 Correct 6 ms 860 KB Output is correct
57 Correct 3 ms 604 KB Output is correct
58 Correct 30 ms 1628 KB Output is correct
59 Correct 20 ms 1112 KB Output is correct
60 Correct 6 ms 1112 KB Output is correct
61 Correct 18 ms 1132 KB Output is correct
62 Correct 18 ms 1128 KB Output is correct
63 Correct 226 ms 1540 KB Output is correct
64 Correct 120 ms 1284 KB Output is correct
65 Correct 10 ms 1116 KB Output is correct
66 Correct 18 ms 1116 KB Output is correct
67 Correct 71 ms 1444 KB Output is correct
68 Correct 124 ms 1284 KB Output is correct
69 Correct 10 ms 1112 KB Output is correct
70 Correct 20 ms 1116 KB Output is correct
71 Correct 70 ms 1428 KB Output is correct
72 Correct 46 ms 1396 KB Output is correct
73 Correct 7 ms 856 KB Output is correct
74 Correct 21 ms 1292 KB Output is correct
75 Correct 46 ms 1412 KB Output is correct
76 Correct 13 ms 1368 KB Output is correct
77 Correct 24 ms 1400 KB Output is correct
78 Correct 7 ms 860 KB Output is correct
79 Correct 6 ms 860 KB Output is correct
80 Correct 12 ms 1116 KB Output is correct
81 Correct 22 ms 1372 KB Output is correct
82 Correct 1 ms 604 KB Output is correct
83 Correct 6 ms 860 KB Output is correct
84 Correct 18 ms 1372 KB Output is correct
85 Correct 1 ms 604 KB Output is correct
86 Correct 20 ms 1440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 8 ms 1076 KB Output is correct
4 Correct 7 ms 860 KB Output is correct
5 Correct 8 ms 1108 KB Output is correct
6 Correct 6 ms 1116 KB Output is correct
7 Correct 7 ms 1116 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 768 KB Output is correct
11 Correct 6 ms 860 KB Output is correct
12 Correct 6 ms 860 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 6 ms 860 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 7 ms 1272 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 6 ms 1116 KB Output is correct
19 Correct 3 ms 604 KB Output is correct
20 Correct 5 ms 860 KB Output is correct
21 Correct 5 ms 860 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 8 ms 860 KB Output is correct
24 Correct 3 ms 604 KB Output is correct
25 Correct 8 ms 860 KB Output is correct
26 Correct 7 ms 860 KB Output is correct
27 Correct 7 ms 1032 KB Output is correct
28 Correct 7 ms 860 KB Output is correct
29 Correct 7 ms 1112 KB Output is correct
30 Correct 8 ms 1112 KB Output is correct
31 Correct 8 ms 1060 KB Output is correct
32 Correct 8 ms 1092 KB Output is correct
33 Correct 8 ms 860 KB Output is correct
34 Correct 8 ms 860 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 600 KB Output is correct
37 Correct 2 ms 604 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 1 ms 604 KB Output is correct
40 Correct 10 ms 1132 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 10 ms 1112 KB Output is correct
43 Correct 10 ms 1368 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Execution timed out 3007 ms 7708 KB Time limit exceeded
46 Halted 0 ms 0 KB -