Submission #481040

# Submission time Handle Problem Language Result Execution time Memory
481040 2021-10-19T10:24:53 Z DJeniUp Political Development (BOI17_politicaldevelopment) C++17
77 / 100
3000 ms 7648 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() {
    
    cin>>n>>k;
    res=0;
    for(int i=1;i<=n;i++){
        ll x;
        cin>>x;
        for(int j=1;j<=x;j++){
            ll y;
            cin>>y;
            y++;
            if(y>i)v[i].pb(y);
        }
    }
    S(1,0);
    cout<<res<<endl;
}

Compilation message

politicaldevelopment.cpp:1: warning: ignoring '#pragma GCC Optimize' [-Wunknown-pragmas]
    1 | #pragma GCC Optimize("O3")
      | 
politicaldevelopment.cpp: In function 'void S(ll, ll)':
politicaldevelopment.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(int i=0;i<v[x].size();i++){
      |                     ~^~~~~~~~~~~~
politicaldevelopment.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(int i=0;i<v[x].size();i++){
      |                     ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 23 ms 1608 KB Output is correct
4 Correct 48 ms 1612 KB Output is correct
5 Correct 53 ms 1612 KB Output is correct
6 Correct 14 ms 1672 KB Output is correct
7 Correct 17 ms 1612 KB Output is correct
8 Correct 9 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 10 ms 1476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 23 ms 1608 KB Output is correct
4 Correct 48 ms 1612 KB Output is correct
5 Correct 53 ms 1612 KB Output is correct
6 Correct 14 ms 1672 KB Output is correct
7 Correct 17 ms 1612 KB Output is correct
8 Correct 9 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 10 ms 1476 KB Output is correct
11 Correct 44 ms 1612 KB Output is correct
12 Correct 50 ms 1648 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 54 ms 1676 KB Output is correct
15 Correct 1 ms 1356 KB Output is correct
16 Correct 17 ms 1676 KB Output is correct
17 Correct 1 ms 1356 KB Output is correct
18 Correct 15 ms 1612 KB Output is correct
19 Correct 10 ms 1484 KB Output is correct
20 Correct 17 ms 1612 KB Output is correct
21 Correct 11 ms 1612 KB Output is correct
22 Correct 9 ms 1484 KB Output is correct
23 Correct 17 ms 1612 KB Output is correct
24 Correct 11 ms 1476 KB Output is correct
25 Correct 16 ms 1700 KB Output is correct
26 Correct 17 ms 1624 KB Output is correct
27 Correct 16 ms 1676 KB Output is correct
28 Correct 17 ms 1684 KB Output is correct
29 Correct 14 ms 1612 KB Output is correct
30 Correct 24 ms 1692 KB Output is correct
31 Correct 18 ms 1704 KB Output is correct
32 Correct 26 ms 1648 KB Output is correct
33 Correct 19 ms 1612 KB Output is correct
34 Correct 18 ms 1704 KB Output is correct
35 Correct 8 ms 1484 KB Output is correct
36 Correct 9 ms 1580 KB Output is correct
37 Correct 9 ms 1484 KB Output is correct
38 Correct 5 ms 1484 KB Output is correct
39 Correct 4 ms 1484 KB Output is correct
40 Correct 24 ms 1772 KB Output is correct
41 Correct 4 ms 1484 KB Output is correct
42 Correct 22 ms 1768 KB Output is correct
43 Correct 23 ms 1684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1484 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 1 ms 1356 KB Output is correct
4 Correct 1 ms 1356 KB Output is correct
5 Correct 1 ms 1356 KB Output is correct
6 Correct 1 ms 1472 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2348 ms 7648 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 2431 ms 7532 KB Output is correct
14 Correct 1 ms 1472 KB Output is correct
15 Correct 2444 ms 7636 KB Output is correct
16 Correct 2396 ms 7524 KB Output is correct
17 Correct 2434 ms 7532 KB Output is correct
18 Correct 2637 ms 7528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 23 ms 1608 KB Output is correct
4 Correct 48 ms 1612 KB Output is correct
5 Correct 53 ms 1612 KB Output is correct
6 Correct 14 ms 1672 KB Output is correct
7 Correct 17 ms 1612 KB Output is correct
8 Correct 9 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 10 ms 1476 KB Output is correct
11 Correct 44 ms 1612 KB Output is correct
12 Correct 50 ms 1648 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 54 ms 1676 KB Output is correct
15 Correct 1 ms 1356 KB Output is correct
16 Correct 17 ms 1676 KB Output is correct
17 Correct 1 ms 1356 KB Output is correct
18 Correct 15 ms 1612 KB Output is correct
19 Correct 10 ms 1484 KB Output is correct
20 Correct 17 ms 1612 KB Output is correct
21 Correct 11 ms 1612 KB Output is correct
22 Correct 9 ms 1484 KB Output is correct
23 Correct 17 ms 1612 KB Output is correct
24 Correct 11 ms 1476 KB Output is correct
25 Correct 16 ms 1700 KB Output is correct
26 Correct 17 ms 1624 KB Output is correct
27 Correct 16 ms 1676 KB Output is correct
28 Correct 17 ms 1684 KB Output is correct
29 Correct 14 ms 1612 KB Output is correct
30 Correct 24 ms 1692 KB Output is correct
31 Correct 18 ms 1704 KB Output is correct
32 Correct 26 ms 1648 KB Output is correct
33 Correct 19 ms 1612 KB Output is correct
34 Correct 18 ms 1704 KB Output is correct
35 Correct 8 ms 1484 KB Output is correct
36 Correct 9 ms 1580 KB Output is correct
37 Correct 9 ms 1484 KB Output is correct
38 Correct 5 ms 1484 KB Output is correct
39 Correct 4 ms 1484 KB Output is correct
40 Correct 24 ms 1772 KB Output is correct
41 Correct 4 ms 1484 KB Output is correct
42 Correct 22 ms 1768 KB Output is correct
43 Correct 23 ms 1684 KB Output is correct
44 Correct 166 ms 1948 KB Output is correct
45 Correct 1 ms 1356 KB Output is correct
46 Correct 20 ms 1688 KB Output is correct
47 Correct 37 ms 1868 KB Output is correct
48 Correct 21 ms 1740 KB Output is correct
49 Correct 39 ms 1868 KB Output is correct
50 Correct 35 ms 1868 KB Output is correct
51 Correct 72 ms 2332 KB Output is correct
52 Correct 26 ms 1612 KB Output is correct
53 Correct 266 ms 2444 KB Output is correct
54 Correct 73 ms 2488 KB Output is correct
55 Correct 15 ms 1612 KB Output is correct
56 Correct 22 ms 1652 KB Output is correct
57 Correct 12 ms 1484 KB Output is correct
58 Correct 310 ms 2408 KB Output is correct
59 Correct 30 ms 1740 KB Output is correct
60 Correct 17 ms 1676 KB Output is correct
61 Correct 33 ms 1740 KB Output is correct
62 Correct 35 ms 1740 KB Output is correct
63 Correct 147 ms 1952 KB Output is correct
64 Correct 104 ms 1912 KB Output is correct
65 Correct 19 ms 1744 KB Output is correct
66 Correct 32 ms 1760 KB Output is correct
67 Correct 77 ms 1944 KB Output is correct
68 Correct 105 ms 1904 KB Output is correct
69 Correct 20 ms 1736 KB Output is correct
70 Correct 50 ms 1868 KB Output is correct
71 Correct 82 ms 2040 KB Output is correct
72 Correct 56 ms 1996 KB Output is correct
73 Correct 14 ms 1672 KB Output is correct
74 Correct 42 ms 1868 KB Output is correct
75 Correct 61 ms 2000 KB Output is correct
76 Correct 40 ms 1776 KB Output is correct
77 Correct 48 ms 2060 KB Output is correct
78 Correct 15 ms 1668 KB Output is correct
79 Correct 18 ms 1740 KB Output is correct
80 Correct 33 ms 1740 KB Output is correct
81 Correct 46 ms 2120 KB Output is correct
82 Correct 4 ms 1488 KB Output is correct
83 Correct 19 ms 1716 KB Output is correct
84 Correct 40 ms 2028 KB Output is correct
85 Correct 4 ms 1484 KB Output is correct
86 Correct 41 ms 2012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1356 KB Output is correct
2 Correct 1 ms 1356 KB Output is correct
3 Correct 23 ms 1608 KB Output is correct
4 Correct 48 ms 1612 KB Output is correct
5 Correct 53 ms 1612 KB Output is correct
6 Correct 14 ms 1672 KB Output is correct
7 Correct 17 ms 1612 KB Output is correct
8 Correct 9 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 10 ms 1476 KB Output is correct
11 Correct 44 ms 1612 KB Output is correct
12 Correct 50 ms 1648 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 54 ms 1676 KB Output is correct
15 Correct 1 ms 1356 KB Output is correct
16 Correct 17 ms 1676 KB Output is correct
17 Correct 1 ms 1356 KB Output is correct
18 Correct 15 ms 1612 KB Output is correct
19 Correct 10 ms 1484 KB Output is correct
20 Correct 17 ms 1612 KB Output is correct
21 Correct 11 ms 1612 KB Output is correct
22 Correct 9 ms 1484 KB Output is correct
23 Correct 17 ms 1612 KB Output is correct
24 Correct 11 ms 1476 KB Output is correct
25 Correct 16 ms 1700 KB Output is correct
26 Correct 17 ms 1624 KB Output is correct
27 Correct 16 ms 1676 KB Output is correct
28 Correct 17 ms 1684 KB Output is correct
29 Correct 14 ms 1612 KB Output is correct
30 Correct 24 ms 1692 KB Output is correct
31 Correct 18 ms 1704 KB Output is correct
32 Correct 26 ms 1648 KB Output is correct
33 Correct 19 ms 1612 KB Output is correct
34 Correct 18 ms 1704 KB Output is correct
35 Correct 8 ms 1484 KB Output is correct
36 Correct 9 ms 1580 KB Output is correct
37 Correct 9 ms 1484 KB Output is correct
38 Correct 5 ms 1484 KB Output is correct
39 Correct 4 ms 1484 KB Output is correct
40 Correct 24 ms 1772 KB Output is correct
41 Correct 4 ms 1484 KB Output is correct
42 Correct 22 ms 1768 KB Output is correct
43 Correct 23 ms 1684 KB Output is correct
44 Correct 2 ms 1356 KB Output is correct
45 Correct 1796 ms 5888 KB Output is correct
46 Correct 1632 ms 4040 KB Output is correct
47 Correct 1722 ms 5824 KB Output is correct
48 Correct 1696 ms 5832 KB Output is correct
49 Execution timed out 3067 ms 3520 KB Time limit exceeded
50 Halted 0 ms 0 KB -