Submission #803050

# Submission time Handle Problem Language Result Execution time Memory
803050 2023-08-02T20:16:18 Z YassineBenYounes Political Development (BOI17_politicaldevelopment) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
typedef long long ll;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pbds tree<pair<ll, ll>, null_type, less<pair<ll,ll>>,rb_tree_tag, tree_order_statistics_node_update>
using namespace __gnu_pbds;
#define speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
////////////////////Only Clear Code//////////////////////////
void usaco_problem(){
    freopen("milkvisits.in", "r", stdin);
    freopen("milkvisits.out", "w", stdout);
}
 
void init(){
    #ifndef ONLINE_JUDGE
 
freopen("input.txt", "r", stdin);
 
freopen("output.txt", "w", stdout);
 
#endif // ONLINE_JUDGE
}
 
const int mx = 5e4+5;
const int mxnd = mx*33;
const int LOG = 25;
const ll inf = 1e18;
const ll mod = 1e8;
 
vector<int> graph[mx];
 
int ans = 0;
 
vector<int> cur;
bool done[mx];
int n;

bitset<50000> bg[mx];

void solve(int k, bitset<50000> bs){
    ans = max(ans, k);
    if(k == 0){
        for(int i = 0; i < n;i++){ 
            cur.push_back(i);
            done[i] = 1;
            solve(k+1, bg[i]);
            done[i] = 0;
            cur.pop_back();
        }
        return;
    }
	bitset<50005> now = bs;
    while(now != 0){
		long unsigned int to = now._Find_first();
        now[to] = 0;
		solve(k+1, now & bg[to]);
		if(ans == 10) return;
	}
    /*
    for(int adj : graph[cur[0]]){
        if(done[adj])continue;
        bool take = 1;
        for(int x : cur){
            if(mp[x][adj] == 0)take = 0;
        }
        if(take){
            cur.push_back(adj);
            done[adj] = 1;
            solve(k+1);
            done[adj] = 0;
            cur.pop_back();
        }
    }*/
}
 
void run_case(){
    int k;cin >> n >> k;
    for(int i = 0; i < n;i++){
        int c;cin >> c;
        while(c--){
            int x;cin >> x;
            //graph[i].push_back(x);
            bg[i][x] = 1;
        }
    }
    ans = 0;
    solve(0,0);
    cout << ans << endl;
}
 
int main(){
    speed;
    int t = 1;
    //cin >> t;
    while(t--){
        run_case();
    }
}
 
/*
    NEVER GIVE UP!
    DOING SMTHNG IS BETTER THAN DOING NTHNG!!!
    Your Guide when stuck:
    - Continue keyword only after reading the whole input
    - Don't use memset with testcases
    - Check for corner cases(n=1, n=0)
    - Check where you declare n(Be careful of declaring it globally and in main)
*/

Compilation message

politicaldevelopment.cpp: In function 'void solve(int, std::bitset<50000>)':
politicaldevelopment.cpp:55:22: error: conversion from 'bitset<50000>' to non-scalar type 'bitset<50005>' requested
   55 |  bitset<50005> now = bs;
      |                      ^~
politicaldevelopment.cpp:59:18: error: no match for 'operator&' (operand types are 'std::bitset<50005>' and 'std::bitset<50000>')
   59 |   solve(k+1, now & bg[to]);
      |              ~~~ ^ ~~~~~~
      |              |          |
      |              |          bitset<50000>
      |              bitset<50005>
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/cstddef:138:3: note: candidate: 'constexpr std::byte std::operator&(std::byte, std::byte)'
  138 |   operator&(byte __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/cstddef:138:18: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'std::byte'
  138 |   operator&(byte __l, byte __r) noexcept
      |             ~~~~~^~~
In file included from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/ios_base.h:83:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(std::_Ios_Fmtflags, std::_Ios_Fmtflags)'
   83 |   operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:83:27: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'std::_Ios_Fmtflags'
   83 |   operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
      |             ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:125:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(std::_Ios_Openmode, std::_Ios_Openmode)'
  125 |   operator&(_Ios_Openmode __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:125:27: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'std::_Ios_Openmode'
  125 |   operator&(_Ios_Openmode __a, _Ios_Openmode __b)
      |             ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:165:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(std::_Ios_Iostate, std::_Ios_Iostate)'
  165 |   operator&(_Ios_Iostate __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:165:26: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'std::_Ios_Iostate'
  165 |   operator&(_Ios_Iostate __a, _Ios_Iostate __b)
      |             ~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bitset:1435:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const std::bitset<_Nb>&, const std::bitset<_Nb>&)'
 1435 |     operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
      |     ^~~~~~~~
/usr/include/c++/10/bitset:1435:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   deduced conflicting values for non-type parameter '_Nb' ('50005' and '50000')
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/c++/10/bits/shared_ptr_atomic.h:33,
                 from /usr/include/c++/10/memory:85,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:82,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/atomic_base.h:100:3: note: candidate: 'constexpr std::memory_order std::operator&(std::memory_order, std::__memory_order_modifier)'
  100 |   operator&(memory_order __m, __memory_order_modifier __mod)
      |   ^~~~~~~~
/usr/include/c++/10/bits/atomic_base.h:100:26: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'std::memory_order'
  100 |   operator&(memory_order __m, __memory_order_modifier __mod)
      |             ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)'
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50005>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50005>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50000>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)'
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50005>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50000>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const std::valarray<_Tp>&, const std::valarray<_Tp>&)'
 1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1191:1: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50005>' is not derived from 'const std::valarray<_Tp>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)'
 1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1191:1: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50005>' is not derived from 'const std::valarray<_Tp>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)'
 1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1191:1: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:59:25: note:   'std::bitset<50000>' is not derived from 'const std::valarray<_Tp>'
   59 |   solve(k+1, now & bg[to]);
      |                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/future:143:20: note: candidate: 'constexpr std::launch std::operator&(std::launch, std::launch)'
  143 |   constexpr launch operator&(launch __x, launch __y)
      |                    ^~~~~~~~
/usr/include/c++/10/future:143:37: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'std::launch'
  143 |   constexpr launch operator&(launch __x, launch __y)
      |                              ~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:127,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/charconv:668:3: note: candidate: 'constexpr std::chars_format std::operator&(std::chars_format, std::chars_format)'
  668 |   operator&(chars_format __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/charconv:668:26: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'std::chars_format'
  668 |   operator&(chars_format __lhs, chars_format __rhs) noexcept
      |             ~~~~~~~~~~~~~^~~~~
politicaldevelopment.cpp: In function 'void usaco_problem()':
politicaldevelopment.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen("milkvisits.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:14:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen("milkvisits.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp: In function 'void init()':
politicaldevelopment.cpp:20:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 | freopen("input.txt", "r", stdin);
      | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:22:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 | freopen("output.txt", "w", stdout);
      | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~