QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#218697#6743. water235Berlin_JacorWA 8ms50552kbC++14740b2023-10-18 17:10:552023-10-18 17:10:55

Judging History

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

  • [2023-10-18 17:10:55]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:50552kb
  • [2023-10-18 17:10:55]
  • 提交

answer

#include<bits/stdc++.h>
//#define int long long
using namespace std;
//const int mod = 998244353;
	map<int,int>p[1000005];
signed main() {
	int n,m;
	cin>>n>>m;
	int ans=0;
	if(n==1&&m==2) {
		cout<<"2\n1 1";
		return 0;
	}
	if(m==1&&n==2) {
		cout<<"2\n1\n1";
		return 0;
	}
	for(int i=1;i<=n;++i) {
		for(int j=1;j<=m;++j) {
			if(i==1&&j==1){p[i][j]=1;++ans;}
			else if(i==1&&j%2==1){p[i][j]=1;++ans;}
			else if(j==1&&i%2==1){p[i][j]=1;++ans;}
			else if(i==1&&j==m){p[i][j]=1;++ans;}
			else if(i==n&&j==1){p[i][j]=1;++ans;}
		}
	}
	cout<<ans<<"\n";
	for(int i=1;i<=n;++i) {
		for(int j=1;j<=m;++j) {
            if(p[i][j])
			cout<<p[i][j]<<" ";
            else cout<<"0 ";
		}
		cout<<"\n";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 50480kb

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 8ms
memory: 50552kb

input:

3 3

output:

3
1 0 1 
0 0 0 
1 0 0 

result:

ok The answer is correct.

Test #3:

score: 0
Accepted
time: 4ms
memory: 50468kb

input:

1 4

output:

3
1 0 1 1 

result:

ok The answer is correct.

Test #4:

score: -100
Wrong Answer
time: 4ms
memory: 50408kb

input:

2 2

output:

3
1 1 
1 0 

result:

wrong answer The answer is wrong: expected = 2, found = 3