Submission #729172

# Submission time Handle Problem Language Result Execution time Memory
729172 2023-04-23T15:13:13 Z MilosMilutinovic Political Development (BOI17_politicaldevelopment) C++14
4 / 100
1948 ms 1856 KB
#include <bits/stdc++.h>
using namespace std;

int n,k,id[50005];
vector<int> g[50005];

signed main()
{
    scanf("%d%d",&n,&k);
    for(int d,i=0;i<n;i++)
    {
        scanf("%d",&d);
        for(int x,j=0;j<d;j++)
        {
            scanf("%d",&x);
            g[i].push_back(x);
            g[x].push_back(i);
        }
    }
    for(int i=0;i<n;i++) id[i]=-1;
    int ans=1;
    for(int i=0;i<n;i++)
    {
        int deg=(int)g[i].size();
        for(int j=0;j<deg;j++) id[g[i][j]]=j;
        vector<int> a;
        for(int x:g[i])
        {
            int f=(1<<id[x]);
            for(int y:g[x]) if(id[y]!=-1) f+=(1<<id[y]);
            a.push_back(f);
        }
        for(int mask=0;mask<(1<<deg);mask++)
        {
            bool ok=true;
            for(int j=0;j<deg;j++) if(mask>>j&1) if((mask&a[j])!=mask) ok=false;
            if(ok) ans=max(ans,__builtin_popcount(mask)+1);
        }
        for(int j=0;j<deg;j++) id[g[i][j]]=-1;
    }
    printf("%d\n",ans);
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d%d",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~
politicaldevelopment.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d",&d);
      |         ~~~~~^~~~~~~~~
politicaldevelopment.cpp:15:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |             scanf("%d",&x);
      |             ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1480 KB Output is correct
3 Correct 1948 ms 1724 KB Output is correct
4 Correct 319 ms 1856 KB Output is correct
5 Correct 322 ms 1832 KB Output is correct
6 Correct 858 ms 1792 KB Output is correct
7 Correct 866 ms 1788 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 2 ms 1488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1480 KB Output is correct
3 Correct 1948 ms 1724 KB Output is correct
4 Correct 319 ms 1856 KB Output is correct
5 Correct 322 ms 1832 KB Output is correct
6 Correct 858 ms 1792 KB Output is correct
7 Correct 866 ms 1788 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 2 ms 1488 KB Output is correct
11 Correct 308 ms 1844 KB Output is correct
12 Correct 361 ms 1856 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 306 ms 1764 KB Output is correct
15 Incorrect 1 ms 1476 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1492 KB Output is correct
2 Correct 2 ms 1364 KB Output is correct
3 Correct 2 ms 1484 KB Output is correct
4 Correct 1 ms 1476 KB Output is correct
5 Incorrect 2 ms 1480 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1480 KB Output is correct
3 Correct 1948 ms 1724 KB Output is correct
4 Correct 319 ms 1856 KB Output is correct
5 Correct 322 ms 1832 KB Output is correct
6 Correct 858 ms 1792 KB Output is correct
7 Correct 866 ms 1788 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 2 ms 1488 KB Output is correct
11 Correct 308 ms 1844 KB Output is correct
12 Correct 361 ms 1856 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 306 ms 1764 KB Output is correct
15 Incorrect 1 ms 1476 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 2 ms 1480 KB Output is correct
3 Correct 1948 ms 1724 KB Output is correct
4 Correct 319 ms 1856 KB Output is correct
5 Correct 322 ms 1832 KB Output is correct
6 Correct 858 ms 1792 KB Output is correct
7 Correct 866 ms 1788 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1364 KB Output is correct
10 Correct 2 ms 1488 KB Output is correct
11 Correct 308 ms 1844 KB Output is correct
12 Correct 361 ms 1856 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 306 ms 1764 KB Output is correct
15 Incorrect 1 ms 1476 KB Output isn't correct
16 Halted 0 ms 0 KB -