QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#218692 | #6743. water235 | Berlin_Jacor | WA | 3ms | 50372kb | C++14 | 776b | 2023-10-18 17:08:10 | 2023-10-18 17:08:10 |
Judging History
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 2";
return 0;
}
if(m==1&&n==2) {
cout<<"2\n2 1";
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;}
if(i==2&&j==2){p[i][j]=1;++ans;}
if(i==1&&j%2==0&&j>2){p[i][j]=1;++ans;}
if(j==1&&i%2==0&&i>2){p[i][j]=1;++ans;}
if(i==1&&j==m&&j>2){p[i][j]=1;++ans;}
if(i==n&&j==1&&i>2){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: 0
Wrong Answer
time: 3ms
memory: 50372kb
input:
2 1
output:
2 2 1
result:
wrong answer Integer 2 violates the range [0, 1]