Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

#define clr(a,i) memset((a), (i) ,sizeof(a))



int main(){
  int n;
  std::cin >> n;
  std::vector<long long> t(n), a(n);
  long long temp=1;
  rep(i,n) std::cin >> t[i];
  rep(i,n) std::cin >> a[i];
  if(t[t.size()-1]!=a[0]) {
    std::cout << "0" << std::endl;
    return 0;
  }
  long long ma=a[0];
  bool t=false;
  rep(i,n){
    if(i==0||i==n-1) continue;
    if(t[i]==ma&&a[i]==ma) t=true;
    else if(t[i]==ma&&a[i]!=ma&&t=false){
      std::cout << "0" << std::endl;
      return 0;
    }
    if(t[i]==t[i-1]&&t[i]<=t[i+1]&&a[i]<=a[i-1]a[i]==a[i+1]){
      tmp*=min(a[i],t[i])-1;
      tmp%=1000000007;
    }
  }
  std::cout << tmp << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:8: error: conflicting declaration 'bool t'
   42 |   bool t=false;
      |        ^
a.cc:33:26: note: previous declaration as 'std::vector<long long int> t'
   33 |   std::vector<long long> t(n), a(n);
      |                          ^
a.cc:45:30: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'bool')
   45 |     if(t[i]==ma&&a[i]==ma) t=true;
      |                              ^~~~
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'bool' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'bool' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'bool' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:46:31: error: no match for 'operator&&' (operand types are 'bool' and 'std::vector<long long int>')
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                               ^~~
      |                                 |
      |                                 std::vector<long long int>
a.cc:46:31: note: candidate: 'operator&&(bool, bool)' (built-in)
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
a.cc:46:31: note:   no known conversion for argument 2 from 'std::vector<long long int>' to 'bool'
In file included from /usr/include/c++/14/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
  415 |     _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:415:5: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
/usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  415 |     _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:415:5: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
/usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
  415 |     _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:415:5: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
/usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
  415 |     _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:415:5: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
/usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
  415 |     _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:415:5: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
/usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const valarray<_Tp>&)'
 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1206:1: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   mismatched types 'const std::valarray<_Tp>' and 'bool'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
/usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1206:1: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   mismatched types 'const std::valarray<_Tp>' and 'bool'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
/usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1206:1: note:   template argument deduction/substitution failed:
a.cc:46:33: note:   'std::vector<long long int>' is not derived from 'const std::valarray<_Tp>'
   46 |     else if(t[i]==ma&&a[i]!=ma&&t=false){
      |                                 ^
a.cc:50:48: error: expected ')' before 'a'
   50 |     if(t[i]==t[i-1]&&t[i]<=t[i+1]&&a[i]<=a[i-1]a[i]==a[i+1]){
      |       ~                                        ^
      |                                                )
a.cc:51:7: error: 'tmp' was not declared in this scope; did you mean 'temp'?
   51 |       tmp*=min(a[i],t[i])-1;
      |       ^~~
      |       temp
a.cc:55:16: error: 'tmp' was not declared in this scope; did you mean 'temp'?
   55 |   std::cout << tmp << std::endl;
      |                ^~~
      |                temp