Submission #924694

# Submission time Handle Problem Language Result Execution time Memory
924694 2024-02-09T13:31:24 Z Faisal_Saqib Political Development (BOI17_politicaldevelopment) C++17
4 / 100
3000 ms 314636 KB
#include <iostream>
#include <bitset> 
#include <vector>
// any
using namespace std;
const int N=5e4+100;
bitset<N> ma[N];
int n,k,mx=0;
vector<int> deg[100],adj[N];
int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(0);
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++)
	{
		int d=0;
		scanf("%d",&d);
		deg[d].push_back(i);
		while(d--)
		{
			int x;
			scanf("%d",&x);
			ma[i].set(x);
			adj[i].push_back(x);
		}
	}
	// for(int i=1;i<=n;i++)
	// {
		// if(deg[i].size())
		// {
			// int v=deg[i].back();
			// vector<int> adj;
			// for(int j=0;j<n;j++)
				// if(ma[v][j])
					// adj.push_back(j);
			// bitset<N> x;
		// }
	// }
	bitset<N> x;
	for(int v=0;v<n;v++)
	{
		int m=adj[v].size();
		for(int mask=0;mask<(1ll<<m);mask++)
		{
			x=ma[v];
			bool pos=1;
			int onp=1;
			for(int j=0;j<m;j++)
			{
				if(mask&(1ll<<j))
				{
					if(!x[adj[v][j]])
					{
						pos=0;
						break;
					}
					x&=ma[adj[v][j]];
					onp++;
				}
			}
			if(pos)
				mx=max(mx,onp);
		}
		
	}
	printf("%d",mx);
	return 0;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf("%d %d",&n,&k);
      |  ~~~~~^~~~~~~~~~~~~~~
politicaldevelopment.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf("%d",&d);
      |   ~~~~~^~~~~~~~~
politicaldevelopment.cpp:24:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |    scanf("%d",&x);
      |    ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 51 ms 33624 KB Output is correct
4 Correct 10 ms 33628 KB Output is correct
5 Correct 9 ms 33628 KB Output is correct
6 Correct 16 ms 33628 KB Output is correct
7 Correct 15 ms 33628 KB Output is correct
8 Correct 3 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 3 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 51 ms 33624 KB Output is correct
4 Correct 10 ms 33628 KB Output is correct
5 Correct 9 ms 33628 KB Output is correct
6 Correct 16 ms 33628 KB Output is correct
7 Correct 15 ms 33628 KB Output is correct
8 Correct 3 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 3 ms 6744 KB Output is correct
11 Correct 9 ms 33628 KB Output is correct
12 Correct 9 ms 33628 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 9 ms 33628 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 16 ms 33628 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 16 ms 33628 KB Output is correct
19 Correct 3 ms 2652 KB Output is correct
20 Correct 11 ms 33688 KB Output is correct
21 Correct 11 ms 33628 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 31 ms 33628 KB Output is correct
24 Correct 4 ms 7000 KB Output is correct
25 Correct 33 ms 33628 KB Output is correct
26 Correct 27 ms 33732 KB Output is correct
27 Correct 18 ms 33628 KB Output is correct
28 Correct 27 ms 33628 KB Output is correct
29 Correct 18 ms 33628 KB Output is correct
30 Correct 19 ms 33628 KB Output is correct
31 Correct 29 ms 33624 KB Output is correct
32 Correct 21 ms 33628 KB Output is correct
33 Correct 35 ms 33564 KB Output is correct
34 Correct 30 ms 33624 KB Output is correct
35 Correct 13 ms 16984 KB Output is correct
36 Correct 16 ms 17192 KB Output is correct
37 Correct 13 ms 16988 KB Output is correct
38 Execution timed out 3072 ms 10968 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2904 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 2 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Execution timed out 3048 ms 314636 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 51 ms 33624 KB Output is correct
4 Correct 10 ms 33628 KB Output is correct
5 Correct 9 ms 33628 KB Output is correct
6 Correct 16 ms 33628 KB Output is correct
7 Correct 15 ms 33628 KB Output is correct
8 Correct 3 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 3 ms 6744 KB Output is correct
11 Correct 9 ms 33628 KB Output is correct
12 Correct 9 ms 33628 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 9 ms 33628 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 16 ms 33628 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 16 ms 33628 KB Output is correct
19 Correct 3 ms 2652 KB Output is correct
20 Correct 11 ms 33688 KB Output is correct
21 Correct 11 ms 33628 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 31 ms 33628 KB Output is correct
24 Correct 4 ms 7000 KB Output is correct
25 Correct 33 ms 33628 KB Output is correct
26 Correct 27 ms 33732 KB Output is correct
27 Correct 18 ms 33628 KB Output is correct
28 Correct 27 ms 33628 KB Output is correct
29 Correct 18 ms 33628 KB Output is correct
30 Correct 19 ms 33628 KB Output is correct
31 Correct 29 ms 33624 KB Output is correct
32 Correct 21 ms 33628 KB Output is correct
33 Correct 35 ms 33564 KB Output is correct
34 Correct 30 ms 33624 KB Output is correct
35 Correct 13 ms 16984 KB Output is correct
36 Correct 16 ms 17192 KB Output is correct
37 Correct 13 ms 16988 KB Output is correct
38 Execution timed out 3072 ms 10968 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 51 ms 33624 KB Output is correct
4 Correct 10 ms 33628 KB Output is correct
5 Correct 9 ms 33628 KB Output is correct
6 Correct 16 ms 33628 KB Output is correct
7 Correct 15 ms 33628 KB Output is correct
8 Correct 3 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 3 ms 6744 KB Output is correct
11 Correct 9 ms 33628 KB Output is correct
12 Correct 9 ms 33628 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 9 ms 33628 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 16 ms 33628 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 16 ms 33628 KB Output is correct
19 Correct 3 ms 2652 KB Output is correct
20 Correct 11 ms 33688 KB Output is correct
21 Correct 11 ms 33628 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 31 ms 33628 KB Output is correct
24 Correct 4 ms 7000 KB Output is correct
25 Correct 33 ms 33628 KB Output is correct
26 Correct 27 ms 33732 KB Output is correct
27 Correct 18 ms 33628 KB Output is correct
28 Correct 27 ms 33628 KB Output is correct
29 Correct 18 ms 33628 KB Output is correct
30 Correct 19 ms 33628 KB Output is correct
31 Correct 29 ms 33624 KB Output is correct
32 Correct 21 ms 33628 KB Output is correct
33 Correct 35 ms 33564 KB Output is correct
34 Correct 30 ms 33624 KB Output is correct
35 Correct 13 ms 16984 KB Output is correct
36 Correct 16 ms 17192 KB Output is correct
37 Correct 13 ms 16988 KB Output is correct
38 Execution timed out 3072 ms 10968 KB Time limit exceeded
39 Halted 0 ms 0 KB -