QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#131359 | #6743. water235 | Yia | WA | 1ms | 3600kb | C++14 | 1.2kb | 2023-07-27 00:16:51 | 2023-07-27 00:16:54 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int N,M;
cin>>N>>M;
if(N==M){
cout<<N<<"\n";
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(i==j) cout<<"1 ";
else cout<<"0 ";
}
cout<<"\n";
}
}
if(N>M){
int cha=N-M;
int num=M+cha/2;
if(cha%2) num++;
cout<<num<<"\n";
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(i==j) cout<<"1 ";
else if(i>=M&&i-M%2==0&&j==0 || cha%2&&i==N-1&&j==0) cout<<"1 ";
else cout<<"0 ";
}
cout<<"\n";
}
}
if(N<M){
int cha=M-N;
int num=N+cha/2;
if(cha%2) num++;
cout<<num<<"\n";
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(i==j) cout<<"1 ";
else if(j>=N&&j-N%2==0&&i==0 || cha%2&&j==M-1&&i==0) cout<<"1 ";
else cout<<"0 ";
}
cout<<"\n";
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3532kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3472kb
input:
3 3
output:
3 1 0 0 0 1 0 0 0 1
result:
ok The answer is correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
1 4
output:
3 1 1 0 1
result:
ok The answer is correct.
Test #4:
score: 0
Accepted
time: 1ms
memory: 3420kb
input:
2 2
output:
2 1 0 0 1
result:
ok The answer is correct.
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 3600kb
input:
2 4
output:
3 1 0 0 0 0 1 0 0
result:
wrong answer Invalid output