# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
481041 | 2021-10-19T10:30:09 Z | DJeniUp | Political Development (BOI17_politicaldevelopment) | C++17 | 3000 ms | 5060 KB |
#pragma GCC Optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll>pairll; typedef pair<ll,pairll>pairlll; typedef pair<pairll,pairll>pairllll; typedef long double ld; typedef pair<ll,string>pairls; #define INF 1000000000000007 #define MOD 1000000007 #define pb push_back #define fr first #define sc second #define endl '\n' ll n,k,f[50007],res; vector<ll>v[50007]; void S(ll x,ll y){ if(x==n+1){ res=max(res,y); return ; } if(f[x]==y){ for(int i=0;i<v[x].size();i++){ f[v[x][i]]++; } S(x+1,y+1); for(int i=0;i<v[x].size();i++){ f[v[x][i]]--; } } S(x+1,y); return ; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //cin>>n>>k; scanf("%lld %lld", &n, &k); res=0; for(int i=1;i<=n;i++){ ll x; //cin>>x; scanf("%lld", &x); for(int j=1;j<=x;j++){ ll y; //cin>>y; scanf("%lld", &y); y++; if(y>i)v[i].pb(y); } } S(1,0); //cout<<res<<endl; printf("%lld", res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1484 KB | Output is correct |
2 | Correct | 1 ms | 1484 KB | Output is correct |
3 | Correct | 14 ms | 1636 KB | Output is correct |
4 | Correct | 46 ms | 1612 KB | Output is correct |
5 | Correct | 48 ms | 1612 KB | Output is correct |
6 | Correct | 14 ms | 1612 KB | Output is correct |
7 | Correct | 14 ms | 1640 KB | Output is correct |
8 | Correct | 9 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1484 KB | Output is correct |
10 | Correct | 9 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1484 KB | Output is correct |
2 | Correct | 1 ms | 1484 KB | Output is correct |
3 | Correct | 14 ms | 1636 KB | Output is correct |
4 | Correct | 46 ms | 1612 KB | Output is correct |
5 | Correct | 48 ms | 1612 KB | Output is correct |
6 | Correct | 14 ms | 1612 KB | Output is correct |
7 | Correct | 14 ms | 1640 KB | Output is correct |
8 | Correct | 9 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1484 KB | Output is correct |
10 | Correct | 9 ms | 1492 KB | Output is correct |
11 | Correct | 39 ms | 1612 KB | Output is correct |
12 | Correct | 47 ms | 1612 KB | Output is correct |
13 | Correct | 1 ms | 1484 KB | Output is correct |
14 | Correct | 51 ms | 1636 KB | Output is correct |
15 | Correct | 1 ms | 1484 KB | Output is correct |
16 | Correct | 12 ms | 1612 KB | Output is correct |
17 | Correct | 1 ms | 1484 KB | Output is correct |
18 | Correct | 14 ms | 1636 KB | Output is correct |
19 | Correct | 8 ms | 1484 KB | Output is correct |
20 | Correct | 9 ms | 1612 KB | Output is correct |
21 | Correct | 10 ms | 1604 KB | Output is correct |
22 | Correct | 10 ms | 1484 KB | Output is correct |
23 | Correct | 14 ms | 1648 KB | Output is correct |
24 | Correct | 9 ms | 1484 KB | Output is correct |
25 | Correct | 15 ms | 1612 KB | Output is correct |
26 | Correct | 13 ms | 1612 KB | Output is correct |
27 | Correct | 12 ms | 1636 KB | Output is correct |
28 | Correct | 13 ms | 1612 KB | Output is correct |
29 | Correct | 14 ms | 1612 KB | Output is correct |
30 | Correct | 20 ms | 1612 KB | Output is correct |
31 | Correct | 14 ms | 1612 KB | Output is correct |
32 | Correct | 22 ms | 1580 KB | Output is correct |
33 | Correct | 17 ms | 1652 KB | Output is correct |
34 | Correct | 14 ms | 1652 KB | Output is correct |
35 | Correct | 7 ms | 1484 KB | Output is correct |
36 | Correct | 6 ms | 1484 KB | Output is correct |
37 | Correct | 5 ms | 1484 KB | Output is correct |
38 | Correct | 3 ms | 1484 KB | Output is correct |
39 | Correct | 3 ms | 1456 KB | Output is correct |
40 | Correct | 18 ms | 1612 KB | Output is correct |
41 | Correct | 2 ms | 1484 KB | Output is correct |
42 | Correct | 17 ms | 1696 KB | Output is correct |
43 | Correct | 18 ms | 1684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1484 KB | Output is correct |
2 | Correct | 1 ms | 1484 KB | Output is correct |
3 | Correct | 1 ms | 1484 KB | Output is correct |
4 | Correct | 1 ms | 1484 KB | Output is correct |
5 | Correct | 1 ms | 1484 KB | Output is correct |
6 | Correct | 1 ms | 1484 KB | Output is correct |
7 | Correct | 1 ms | 1484 KB | Output is correct |
8 | Correct | 1 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1484 KB | Output is correct |
10 | Correct | 1 ms | 1484 KB | Output is correct |
11 | Correct | 2317 ms | 4908 KB | Output is correct |
12 | Correct | 1 ms | 1484 KB | Output is correct |
13 | Correct | 2214 ms | 5028 KB | Output is correct |
14 | Correct | 1 ms | 1484 KB | Output is correct |
15 | Correct | 2246 ms | 4932 KB | Output is correct |
16 | Correct | 2211 ms | 4904 KB | Output is correct |
17 | Correct | 2270 ms | 4932 KB | Output is correct |
18 | Correct | 2266 ms | 5060 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1484 KB | Output is correct |
2 | Correct | 1 ms | 1484 KB | Output is correct |
3 | Correct | 14 ms | 1636 KB | Output is correct |
4 | Correct | 46 ms | 1612 KB | Output is correct |
5 | Correct | 48 ms | 1612 KB | Output is correct |
6 | Correct | 14 ms | 1612 KB | Output is correct |
7 | Correct | 14 ms | 1640 KB | Output is correct |
8 | Correct | 9 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1484 KB | Output is correct |
10 | Correct | 9 ms | 1492 KB | Output is correct |
11 | Correct | 39 ms | 1612 KB | Output is correct |
12 | Correct | 47 ms | 1612 KB | Output is correct |
13 | Correct | 1 ms | 1484 KB | Output is correct |
14 | Correct | 51 ms | 1636 KB | Output is correct |
15 | Correct | 1 ms | 1484 KB | Output is correct |
16 | Correct | 12 ms | 1612 KB | Output is correct |
17 | Correct | 1 ms | 1484 KB | Output is correct |
18 | Correct | 14 ms | 1636 KB | Output is correct |
19 | Correct | 8 ms | 1484 KB | Output is correct |
20 | Correct | 9 ms | 1612 KB | Output is correct |
21 | Correct | 10 ms | 1604 KB | Output is correct |
22 | Correct | 10 ms | 1484 KB | Output is correct |
23 | Correct | 14 ms | 1648 KB | Output is correct |
24 | Correct | 9 ms | 1484 KB | Output is correct |
25 | Correct | 15 ms | 1612 KB | Output is correct |
26 | Correct | 13 ms | 1612 KB | Output is correct |
27 | Correct | 12 ms | 1636 KB | Output is correct |
28 | Correct | 13 ms | 1612 KB | Output is correct |
29 | Correct | 14 ms | 1612 KB | Output is correct |
30 | Correct | 20 ms | 1612 KB | Output is correct |
31 | Correct | 14 ms | 1612 KB | Output is correct |
32 | Correct | 22 ms | 1580 KB | Output is correct |
33 | Correct | 17 ms | 1652 KB | Output is correct |
34 | Correct | 14 ms | 1652 KB | Output is correct |
35 | Correct | 7 ms | 1484 KB | Output is correct |
36 | Correct | 6 ms | 1484 KB | Output is correct |
37 | Correct | 5 ms | 1484 KB | Output is correct |
38 | Correct | 3 ms | 1484 KB | Output is correct |
39 | Correct | 3 ms | 1456 KB | Output is correct |
40 | Correct | 18 ms | 1612 KB | Output is correct |
41 | Correct | 2 ms | 1484 KB | Output is correct |
42 | Correct | 17 ms | 1696 KB | Output is correct |
43 | Correct | 18 ms | 1684 KB | Output is correct |
44 | Correct | 144 ms | 1780 KB | Output is correct |
45 | Correct | 1 ms | 1484 KB | Output is correct |
46 | Correct | 17 ms | 1696 KB | Output is correct |
47 | Correct | 29 ms | 1808 KB | Output is correct |
48 | Correct | 19 ms | 1612 KB | Output is correct |
49 | Correct | 29 ms | 1740 KB | Output is correct |
50 | Correct | 27 ms | 1752 KB | Output is correct |
51 | Correct | 63 ms | 1952 KB | Output is correct |
52 | Correct | 23 ms | 1612 KB | Output is correct |
53 | Correct | 259 ms | 2052 KB | Output is correct |
54 | Correct | 58 ms | 1996 KB | Output is correct |
55 | Correct | 12 ms | 1636 KB | Output is correct |
56 | Correct | 18 ms | 1644 KB | Output is correct |
57 | Correct | 10 ms | 1496 KB | Output is correct |
58 | Correct | 294 ms | 1996 KB | Output is correct |
59 | Correct | 29 ms | 1612 KB | Output is correct |
60 | Correct | 12 ms | 1640 KB | Output is correct |
61 | Correct | 26 ms | 1612 KB | Output is correct |
62 | Correct | 25 ms | 1612 KB | Output is correct |
63 | Correct | 154 ms | 1740 KB | Output is correct |
64 | Correct | 104 ms | 1740 KB | Output is correct |
65 | Correct | 19 ms | 1612 KB | Output is correct |
66 | Correct | 29 ms | 1668 KB | Output is correct |
67 | Correct | 72 ms | 1840 KB | Output is correct |
68 | Correct | 93 ms | 1752 KB | Output is correct |
69 | Correct | 17 ms | 1612 KB | Output is correct |
70 | Correct | 30 ms | 1740 KB | Output is correct |
71 | Correct | 60 ms | 1828 KB | Output is correct |
72 | Correct | 47 ms | 1740 KB | Output is correct |
73 | Correct | 13 ms | 1612 KB | Output is correct |
74 | Correct | 32 ms | 1740 KB | Output is correct |
75 | Correct | 54 ms | 1740 KB | Output is correct |
76 | Correct | 21 ms | 1736 KB | Output is correct |
77 | Correct | 36 ms | 1888 KB | Output is correct |
78 | Correct | 14 ms | 1632 KB | Output is correct |
79 | Correct | 12 ms | 1656 KB | Output is correct |
80 | Correct | 26 ms | 1740 KB | Output is correct |
81 | Correct | 35 ms | 1820 KB | Output is correct |
82 | Correct | 3 ms | 1484 KB | Output is correct |
83 | Correct | 13 ms | 1708 KB | Output is correct |
84 | Correct | 31 ms | 1840 KB | Output is correct |
85 | Correct | 2 ms | 1484 KB | Output is correct |
86 | Correct | 31 ms | 1740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1484 KB | Output is correct |
2 | Correct | 1 ms | 1484 KB | Output is correct |
3 | Correct | 14 ms | 1636 KB | Output is correct |
4 | Correct | 46 ms | 1612 KB | Output is correct |
5 | Correct | 48 ms | 1612 KB | Output is correct |
6 | Correct | 14 ms | 1612 KB | Output is correct |
7 | Correct | 14 ms | 1640 KB | Output is correct |
8 | Correct | 9 ms | 1484 KB | Output is correct |
9 | Correct | 1 ms | 1484 KB | Output is correct |
10 | Correct | 9 ms | 1492 KB | Output is correct |
11 | Correct | 39 ms | 1612 KB | Output is correct |
12 | Correct | 47 ms | 1612 KB | Output is correct |
13 | Correct | 1 ms | 1484 KB | Output is correct |
14 | Correct | 51 ms | 1636 KB | Output is correct |
15 | Correct | 1 ms | 1484 KB | Output is correct |
16 | Correct | 12 ms | 1612 KB | Output is correct |
17 | Correct | 1 ms | 1484 KB | Output is correct |
18 | Correct | 14 ms | 1636 KB | Output is correct |
19 | Correct | 8 ms | 1484 KB | Output is correct |
20 | Correct | 9 ms | 1612 KB | Output is correct |
21 | Correct | 10 ms | 1604 KB | Output is correct |
22 | Correct | 10 ms | 1484 KB | Output is correct |
23 | Correct | 14 ms | 1648 KB | Output is correct |
24 | Correct | 9 ms | 1484 KB | Output is correct |
25 | Correct | 15 ms | 1612 KB | Output is correct |
26 | Correct | 13 ms | 1612 KB | Output is correct |
27 | Correct | 12 ms | 1636 KB | Output is correct |
28 | Correct | 13 ms | 1612 KB | Output is correct |
29 | Correct | 14 ms | 1612 KB | Output is correct |
30 | Correct | 20 ms | 1612 KB | Output is correct |
31 | Correct | 14 ms | 1612 KB | Output is correct |
32 | Correct | 22 ms | 1580 KB | Output is correct |
33 | Correct | 17 ms | 1652 KB | Output is correct |
34 | Correct | 14 ms | 1652 KB | Output is correct |
35 | Correct | 7 ms | 1484 KB | Output is correct |
36 | Correct | 6 ms | 1484 KB | Output is correct |
37 | Correct | 5 ms | 1484 KB | Output is correct |
38 | Correct | 3 ms | 1484 KB | Output is correct |
39 | Correct | 3 ms | 1456 KB | Output is correct |
40 | Correct | 18 ms | 1612 KB | Output is correct |
41 | Correct | 2 ms | 1484 KB | Output is correct |
42 | Correct | 17 ms | 1696 KB | Output is correct |
43 | Correct | 18 ms | 1684 KB | Output is correct |
44 | Correct | 1 ms | 1484 KB | Output is correct |
45 | Correct | 1637 ms | 4168 KB | Output is correct |
46 | Correct | 1518 ms | 3132 KB | Output is correct |
47 | Correct | 1795 ms | 4052 KB | Output is correct |
48 | Correct | 1628 ms | 4052 KB | Output is correct |
49 | Execution timed out | 3084 ms | 2888 KB | Time limit exceeded |
50 | Halted | 0 ms | 0 KB | - |