結果

問題 No.2256 Step by Step
ユーザー liuhengxi2007
提出日時 2025-05-21 16:58:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,840 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 44,656 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-05-21 16:58:40
合計ジャッジ時間 5,183 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

// created:  2025-05-21 10:49:24
#include<cstdio>
#include<cctype>
#include<algorithm>
#define F(i,l,r) for(int i=l,i##_end=r;i<i##_end;++i)
#define I128 //||is_same<T,__int128_t>::value||is_same<T,__uint128_t>::value
using namespace std;
template<typename T>enable_if_t<is_integral<T>::value I128,void> readmain(T &x)
{
	bool neg=false;int c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=true;
	for(x=0;isdigit(c);c=getchar())x=(T)(10*x+(c-'0'));
	if(neg)x=-x;
}
template<typename T>T& read(T &x){readmain(x);return x;}
template<typename T,typename ...Tr>void read(T &x,Tr&... r){readmain(x);read(r...);}
constexpr int N=1005;
int n;
char s[6][N];
char &next(int x,int y)
{
	int c=0;
	while(s[c][y]!='#'||x)x-=s[c++][y]=='#';
	return s[c][y];
}
int main()
{
	read(n);
	if(n==1)
	{
		puts("0\n1\n1\n1\n0\n0");
		return 0;
	}
	if(n==2)
	{
		puts("02\n13\n12\n13\n02\n03");
		return 0;
	}
	if(n==3)
	{
		puts("012\n345\n345\n225\n141\n300");
		return 0;
	}
	if(n==4)
	{
		printf(R"(
7446
3775
1664
0335
0225
0112
)"+1);
		return 0;
	}
	if(n==5)
	{
		printf(R"(
79746
98965
18435
07234
08622
01135
)"+1);
		return 0;
	}
	if(n==6)
	{
		printf(R"(
566991
355710
144180
033689
022477
011280
)"+1);
		return 0;
	}
	if(n==7)
	{
		printf(R"(
3568113
5487932
1437302
0356601
0427899
0112202
)"+1);
		return 0;
	}
	if(n==8)
	{
		printf(R"(
56655024
35579513
14498200
03368413
02247712
01128943
)"+1);
		return 0;
	}
	F(i,0,6)F(j,0,n)s[i][j]='#';
	next(0,0)='4';
	next(0,0)='4';
	next(0,0)='4';
	F(i,0,n-2)
	{
		next(1,i)="0123"[i&3];
		next(1,i+1)="0123"[i&3];
		next(1,i+2)="0123"[i&3];
	}
	next(0,n-1)='4';
	next(0,n-1)='4';
	next(0,n-1)='4';
	for(int i=n-2;~--i;)
	{
		next(0,i)="5678"[i&3];
		next(0,i+1)="5678"[i&3];
		next(0,i+2)="5678"[i&3];
	}
	F(i,0,6)F(j,0,n)if(s[i][j]=='#')s[i][j]='9';
	for(int i=6;~--i;)puts(s[i]);
	return 0;
}
0