QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#297257#6309. AqregeorgeyucjrCompile Error//C++205.2kb2024-01-04 08:49:452024-01-04 08:49:45

Judging History

你现在查看的是最新测评结果

  • [2024-01-04 08:49:45]
  • 评测
  • [2024-01-04 08:49:45]
  • 提交

answer

    # include <bits/stdc++.h>
# if __cplusplus >= 201100LL
# else
# error Please use C++11 Or Higher CPP version
# endif
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using arr3 = std :: array < int, 3 >;
using arr4 = std :: array < int, 4 >;
using pii = std :: pair < int, int >;
# if __cplusplus >= 201400LL
  # define rep(i, f, t, ...) for ( std :: decay < decltype ( f + t ) > :: type i = f, ##__VA_ARGS__; i <= t; ++i )
  # define red(i, f, t, ...) for ( std :: decay < decltype ( f + t ) > :: type i = f, ##__VA_ARGS__; i >= t; --i )
# else
  # define rep(i, f, t, ...) for ( decltype ( f + t ) i = f, ##__VA_ARGS__; i <= t; ++i )
  # define red(i, f, t, ...) for ( decltype ( f + t ) i = f, ##__VA_ARGS__; i >= t; --i )
# endif
# define emb emplace_back
# define pb push_back
# define mkp make_pair
# define FILEIO(filename) freopen(filename ".in", "r", stdin), freopen(filename ".out", "w", stdout)
# define ALL( vc ) vc.begin ( ), vc.end ( )

# ifndef INLINE_V
  # if __cplusplus >= 201700LL
    # define INLINE_V inline
  # else
    # define INLINE_V
  # endif
# endif
# if __cplusplus >= 202000LL
  template < class T > 
    requires ( std :: is_signed_v < T > && std :: is_integral_v < T > )
  INLINE_V constexpr static T inf = std :: numeric_limits < T > :: max ( ) >> 1;
# elif __cplusplus >= 201400LL
  template < class T, std :: enable_if < std :: is_integral_v < T > || std :: is_signed_v < T > || std :: is_same_v < std :: decay_t < T > , i128 > || std :: is_same_v < std :: decay < T > , u128 > *= nullptr > >
  INLINE_V constexpr static T inf = std :: numeric_limits < T > :: max ( ) >> 1; 
# else
  template < class T >  
  INLINE_V constexpr static T inf = std :: numeric_limits < T > :: max ( ) >> 1;
# endif

bool Mst;

# if __cplusplus >= 201400LL
  # define EXPR constexpr
  # define CPP14_ENABLE_IF enable_if
# else
  # define EXPR
# endif

template < typename T, typename U > 
inline EXPR auto ceil ( T && x, U && y ) { 
  return ( x > 0 ? ( x + y - 1 ) / y : x / y ); 
}

template < typename T, typename U > 
inline EXPR auto floor ( T && x, U && y ) { 
  return ( x > 0 ? x / y : ( x - y + 1 ) / y ); 
}

template < typename T, typename U > 
inline EXPR auto divmod ( T && x, U && y ) {
  auto && q = floor ( x, y );
  return std :: pair { q, x - q * y };
}

# if __cplusplus >= 202000LL

template <std :: ranges::forward_range R> 
inline constexpr auto Sum ( R && r ) {
  return std :: accumulate ( std :: ranges :: begin ( r ), std :: ranges :: end ( r ), 0 );
}

template < std :: ranges :: forward_range R, typename T > 
inline constexpr auto Sum ( R && r, T init) {
  return std :: accumulate ( std :: ranges :: begin ( r ), std :: ranges :: end ( r ), init );
}

# else

template < class R > 
inline EXPR auto Sum ( R && r ) { 
  return std :: accumulate ( ALL ( r ), 0); 
}

template < class R, typename T > 
inline EXPR auto Sum( R && r, T init ) { 
  return std :: accumulate ( ALL ( r ), init ); 
}

template < class R > 
inline EXPR auto Sum ( R f, R t ) { 
  return std ::accumulate ( f, t ); 
}

template < class R, typename T > 
inline EXPR auto Sum ( R f, R t, T init ) { 
  return std :: accumulate ( f, t, init ); 
}

# endif

template < class T > 
inline EXPR int SZ ( T && x ) { return std :: size ( x ); }

using namespace std;

# ifndef __GEORGEYUCJR_READ__
  # ifdef LINUX
    # include <georgeyucjr/debug.h>
    using namespace georgeyucjr;
  # else
    # define write(...) void ( 36 )
    # define bug(...) void ( 36 )
  # endif
# else
  # warning Do not use debug.hpp.
# endif


bool Med;

signed main() {
# ifndef __GEORGEYUCJR_READ__
  ios_base :: sync_with_stdio ( false ), cin.tie ( nullptr ), cout.tie ( nullptr );
# endif
  auto slv=[](){
  	int n,m;
  	cin>>n>>m;
  	// vector<string>st(n+1,string(m+1));
  	// vector<string>ans(n+1,string(m+1));
  	string _;_.resize(m+1);
  	vector<string>st;st.assign(n+1,_);
  	vector<string>ans;ans.assign(n+1,_);
  	int ty=0;
    if(n>m)swap(n,m),ty=1;
    auto solve=[&st](int n,int m){
	    INLINE_V constexpr static int dt[][4]={{0,2,1,3},{0,1,3,2},{0,2,0}};
			if(n<=3 && m<=3){
				rep(i,1,n)fill(st[i]+1,st[i]+m+1,49);
		  }else if(n==2){
	      rep(i,1,n)rep(j,1,m)
          st[i][j]=((dt[0][i-1]+j)%4!=0)+'0';
		  }else if(n==3){
		  	rep(i,1,n)rep(j,1,m)st[i][j]=((dt[2][i-1]+j)%4!=0)+'0';
		  }else if(n>=4){
	      int typ=0;
	      if((n%4==2 && m%4==2) || (n%4==1 && m%4==1))typ=1;
	      rep(i,1,n)rep(j,1,m)st[i][j]=((dt[typ][(i-1)%4]+j)%4!=0)+'0';
		  }
    }
    solve(n,m);
    int cnt=0;
    rep(i,1,n)rep(j,1,m){
      if(ty)ans[j][i]=st[i][j];
      else ans[i][j]=st[i][j];
      cnt+=st[i][j]-'0';
    }
    if(type)swap(n,m);
    cout<<cnt<<endl;
    rep(i,1,n){
      ans[i][m+1]='\0';
      cout<<(ans[i]+1)<<endl;
    }
  };int T;cin>>T;while(T--)slv();

# ifdef LOCAL
  cerr << "Memory & Time Information : " << endl;
  cerr << "Memory : " << ( ( & Med ) - ( & Mst ) ) * 1. / 1024. / 1024. << "MB" << endl;
  cerr << "Time : " << clock ( ) * 1. / CLOCKS_PER_SEC * 1000. << "ms" << endl;
# endif
  return 0;
}


Details

answer.code: In lambda function:
answer.code:28:23: error: ‘inline’ specifier invalid for variable ‘dt’ declared at block scope
   28 |     # define INLINE_V inline
      |                       ^~~~~~
answer.code:141:13: note: in expansion of macro ‘INLINE_V’
  141 |             INLINE_V constexpr static int dt[][4]={{0,2,1,3},{0,1,3,2},{0,2,0}};
      |             ^~~~~~~~
answer.code:143:53: error: no match for ‘operator+’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type’ {aka ‘std::__cxx11::basic_string<char>’} and ‘int’)
  143 |                                 rep(i,1,n)fill(st[i]+1,st[i]+m+1,49);
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_iterator.h:585:5: note: candidate: ‘template<class _Iterator> constexpr std::reverse_iterator<_IteratorL> std::operator+(typename std::reverse_iterator<_IteratorL>::difference_type, const std::reverse_iterator<_IteratorL>&)’
  585 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:585:5: note:   template argument deduction/substitution failed:
answer.code:143:54: note:   mismatched types ‘const std::reverse_iterator<_IteratorL>’ and ‘int’
  143 |                                 rep(i,1,n)fill(st[i]+1,st[i]+m+1,49);
      |                                                      ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_iterator.h:1700:5: note: candidate: ‘template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)’
 1700 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1700:5: note:   template argument deduction/substitution failed:
answer.code:143:54: note:   mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’
  143 |                                 rep(i,1,n)fill(st[i]+1,st[i]+m+1,49);
      |                                                      ^
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/bits/basic_string.h:6095:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)’
 6095 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6095:5: note:   template argument deduction/substitution failed:
answer.code:143:54: note:   mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ and ‘int’
  143 |                                 rep(i,1,n)fill(st[i]+1,st[i]+m+1,49);
      |                                                      ^
In file included from /usr/include/c++/11/string:56,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/bits/basic_string.tcc:1169:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)’
 1169 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.tcc:1169:5: note:   template argument dedu...