QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#640880#6743. water235EMTzWA 1ms3684kbC++201.7kb2024-10-14 16:40:322024-10-14 16:40:33

Judging History

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

  • [2024-10-14 16:40:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3684kb
  • [2024-10-14 16:40:32]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define ull unsigned long long
using namespace std;
typedef pair<int,int>PII;
typedef pair<int,PII>PPI;
typedef array<int,3>ar;
const int N=1e3+7;
const int N1=1e7;
const int M=1e9+7;
const ull mask = std::chrono::steady_clock::now().time_since_epoch().count();
mt19937_64 rng(time(0));
const int M1=19260817;
const int base=233;
const int base1=131;
vector<int>E[N];
int st[N][N];
int son[N][3];
int mp[N],mp1[N];
void solve()
{
	int n,m;
	cin>>n>>m;
	if(n==1&&m==1)
	{
		cout<<"1\n1\n";
	}
	else if(n==1&&m==2)
	{
		cout<<2<<"\n";
		cout<<"1 1\n";
	}
	else if(n==2&&m==1)
	{
		cout<<2<<"\n";
		cout<<"1\n1\n";
	}
	else if(n==2&&m==2)
	{
		cout<<2<<"\n";
		cout<<"1 0\n";
		cout<<"0 1\n";
	}
	else if(n==2&&m==3)
	{
		cout<<3<<"\n";
		cout<<"1 0 1\n";
		cout<<"0 1 0\n";
	}
	else if(n==3&&m==2)
	{
		cout<<3<<"\n";
		cout<<"1 0\n";
		cout<<"0 1\n";
		cout<<"1 0\n";
	}
	else 
	{
		int ans=3;
		int a1=(n-3)/2+(n-3)%2;
		int b1=(m-3)/2+(m-3)%2;
		ans+=a1+b1;
		cout<<ans<<"\n";
		cout<<"1 0 1 ";
		for(int i=1;i<=m-3;i++) cout<<"0 ";
		cout<<"\n";
		cout<<"0 0 0 ";
		for(int i=1;i<=m-3;i++)
		{
			if(i%2==0||i==m-3) cout<<"1 ";
			else cout<<"0 ";
		}
		cout<<"\n";
		cout<<"0 1 0 ";
		for(int i=1;i<=m-3;i++) cout<<"0 ";
		cout<<"\n";
		for(int i=1;i<=n-3;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(i%2==0||i==n-3)
				{
					if(j==2) cout<<"1 ";
					else cout<<"0 ";
				}
				else cout<<"0 ";
			}
			cout<<"\n";
		}
	}
}

signed main()
{
	std::ios::sync_with_stdio(false);
	cout.tie(0);cin.tie(0);
	int _=1;
//	cin>>_;
	while(_--)
	{
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

3 3

output:

3
1 0 1 
0 0 0 
0 1 0 

result:

ok The answer is correct.

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3628kb

input:

1 4

output:

3
1 0 1 0 
0 0 0 1 
0 1 0 0 

result:

wrong answer Invalid output