QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297278#6309. AqregeorgeyucjrCompile Error//C++203.1kb2024-01-04 09:16:212024-01-04 09:16:22

Judging History

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

  • [2024-01-04 09:16:22]
  • 评测
  • [2024-01-04 09:16:21]
  • 提交

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


bool Mst;

# if __cplusplus >= 201400LL
  # define EXPR constexpr
  # define CPP14_ENABLE_IF enable_if
# else
  # define EXPR
# endif 
template < class T > 
inline EXPR int SZ ( T && x ) { return x.size ( ); }

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));
	constexpr static INLINE_V int N = 1e3 + 5;
  	static char st[N][N], ans[N][N];
	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(ty)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;
}


詳細信息

answer.code: In lambda function:
answer.code:28:23: error: ‘inline’ specifier invalid for variable ‘N’ declared at block scope
   28 |     # define INLINE_V inline
      |                       ^~~~~~
answer.code:72:26: note: in expansion of macro ‘INLINE_V’
   72 |         constexpr static INLINE_V int N = 1e3 + 5;
      |                          ^~~~~~~~
answer.code:76:18: warning: capture of variable ‘st’ with non-automatic storage duration
   76 |     auto solve=[&st](int n,int m){
      |                  ^~
answer.code:73:21: note: ‘char st [1005][1005]’ declared here
   73 |         static char st[N][N], ans[N][N];
      |                     ^~
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:77:13: note: in expansion of macro ‘INLINE_V’
   77 |             INLINE_V constexpr static int dt[][4]={{0,2,1,3},{0,1,3,2},{0,2,0}};
      |             ^~~~~~~~