Submission #593752

# Submission time Handle Problem Language Result Execution time Memory
593752 2022-07-11T14:35:22 Z nguyentu Nautilus (BOI19_nautilus) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

#define ii pair<int , int>  
#define iv pair<ii , ii>
#define iii pair<int , ii>
#define fi first
#define se second
//#define int long long
const int inf = 1e9 + 7;
const int MAX_N = 5e2 + 7;
const int MOD = 1e9 + 7;

char a[MAX_N][MAX_N];
int f[MAX_N][MAX_N][107];
char s[5007];
bitset<5007> dp[2][MAX_N];
bitset<5007> d[MAX_N];

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    int n , m , l; cin >> n >> m >> l;
    //subtask 3
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < m ; j++) {
                cin >> a[i][j];
                if (a[i][j] == '#') {
                    d[i][j] = 0;
                    dp[1][i][j] = 0;
                }
				else {
					d[i][j] = 1;
					dp[1][i][j] = 1;
				}
            }
        }
        for (int i = 0 ; i < l ; i++) {
            cin >> s[i];
        }
        for (int i = 0 ; i < l ; i++) {
            int now = i & 1;
            int prev = now ^ 1;
            for (int j = 0 ; j < n ; j++) {
                if (s[i] == 'W') {
                    dp[now][j] = dp[prev][j] >> 1;
                }
                else if (s[i] == 'E') {
                    dp[now][j] = dp[prev][j] << 1;
                }
                else if (s[i] == 'S') {
                    dp[now][j] = dp[prev][j - 1];
                }
                else if (s[i] == 'N') {
                    dp[now][j] = dp[prev][j + 1];
                }
                else if (s[i] == '?') {
                    dp[now][j] = (dp[prev][j] >> 1);
                    dp[now][j] |= (dp[prev][j] << 1);
					if ((j - 1) >= 0)
                    dp[now][j] |= dp[prev][j - 1];
					if ((j + 1) < n)
                    dp[now][j] |= dp[prev][j + 1];
                }
            }
            for (int j = 0 ; j < n ; j++) {
                dp[prev][j] = dp[now][j] & dp[j];
            }
			// for (int j = 0 ; j < n ; j++) {
			// 	dp[now][j].reset
			// }
        }
        int ans = 0;
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < m ; j++) {
                if (dp[(l - 1) & 1][i][j]) {
                    ans++;
                }
				//cout << dp[(l - 1) & 1][i][j] << " ";
            }
			//cout << '\n';
        }
        cout << ans;
    //}
    return 0;
}

// 1 1 0 0 0 0 1 1 0 
// 1 1 0 0 0 0 1 1 0 
// 1 1 0 1 1 1 1 0 0 
// 1 0 0 1 1 1 0 1 0 
// 1 0 1 1 0 1 1 1 1

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:71:42: error: no match for 'operator&' (operand types are 'std::bitset<5007>' and 'std::bitset<5007> [507]')
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                               ~~~~~~~~~~ ^ ~~~~~
      |                                        |       |
      |                                        |       std::bitset<5007> [507]
      |                                        std::bitset<5007>
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 nautilus.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<5007>' 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<5007>' 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<5007>' 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 nautilus.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:
nautilus.cpp:71:48: note:   mismatched types 'const std::bitset<_Nb>' and 'std::bitset<5007> [507]'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
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 nautilus.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<5007>' 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 nautilus.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:
nautilus.cpp:71:48: note:   'std::bitset<5007>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from nautilus.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:
nautilus.cpp:71:48: note:   'std::bitset<5007>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from nautilus.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:
nautilus.cpp:71:48: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'std::bitset<5007> [507]'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from nautilus.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:
nautilus.cpp:71:48: note:   'std::bitset<5007>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from nautilus.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:
nautilus.cpp:71:48: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'std::bitset<5007> [507]'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from nautilus.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:
nautilus.cpp:71:48: note:   'std::bitset<5007>' is not derived from 'const std::valarray<_Tp>'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from nautilus.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:
nautilus.cpp:71:48: note:   'std::bitset<5007>' is not derived from 'const std::valarray<_Tp>'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from nautilus.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:
nautilus.cpp:71:48: note:   mismatched types 'const std::valarray<_Tp>' and 'std::bitset<5007> [507]'
   71 |                 dp[prev][j] = dp[now][j] & dp[j];
      |                                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from nautilus.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<5007>' to 'std::launch'
  143 |   constexpr launch operator&(launch __x, launch __y)
      |                              ~~~~~~~^~~