Submission #475729

# Submission time Handle Problem Language Result Execution time Memory
475729 2021-09-23T21:21:54 Z CaroLinda Pizza (COCI21_pizza) C++14
50 / 50
1 ms 284 KB
#include <bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define sz(x) (int)(x.size())
#define ll long long
#define lp(i,a,b) for(int i = a ; i < b ; i++ )
#define pii pair<int,int>
#define mk make_pair
#define pb push_back

using namespace std ;

int n , m , ans ;
bitset<101> dislikes , pizza ;

int main()
{
	scanf("%d", &n ) ;
	for(int i = 0 , x ; i < n ; i++ )
	{
		scanf("%d", &x ) ;
		dislikes[x] = 1 ;
	}
	scanf("%d", &m ) ;
	for(int i = 0 , y ; i < m ; i++ )
	{
		scanf("%d", &y ) ;
		pizza = 0 ;
		for(int j = 0 , x ; j < y ; j++ )
		{
			scanf("%d", &x) ;
			pizza[x] = 1 ;
		}

		int s = n+pizza.count() ;
		pizza |= dislikes ;
		if(pizza.count() == s ) ans++ ;

	}
	printf("%d\n" , ans ) ;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:37:20: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |   if(pizza.count() == s ) ans++ ;
      |      ~~~~~~~~~~~~~~^~~~
Main.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  scanf("%d", &n ) ;
      |  ~~~~~^~~~~~~~~~~
Main.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   scanf("%d", &x ) ;
      |   ~~~~~^~~~~~~~~~~
Main.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d", &m ) ;
      |  ~~~~~^~~~~~~~~~~
Main.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |   scanf("%d", &y ) ;
      |   ~~~~~^~~~~~~~~~~
Main.cpp:31:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |    scanf("%d", &x) ;
      |    ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct