QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#361597 | #6743. water235 | Susie_Rain# | WA | 0ms | 3640kb | C++20 | 980b | 2024-03-23 11:50:56 | 2024-03-23 11:50:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n , m;
cin >> n >> m;
vector<vector<int>> a(n+1,vector<int>(m+1));
for(int i=1;i<=n;i+=2){
a[1][i] = 1;
}
if(m%2==0){
// a[2][m] = 1;
for(int i=2;i<=n;i+=2){
a[i][m] = 1;
}
if(n%2==1){
a[n][m] = 1;
}
} else{
if(n%2==0){
a[n][m] = 1;
}
for(int i=1;i<=n;i+=2){
a[i][m] = 1;
}
}
int cnt = 0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(a[i][j] == 1) cnt ++;
}
}
cout << cnt << '\n';
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cout << a[i][j] << ' ';
}
cout << '\n';
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int tt = 1;
// cin >> tt;
while (tt--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
3 3
output:
3 1 0 1 0 0 0 0 0 1
result:
ok The answer is correct.
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3576kb
input:
1 4
output:
2 1 0 0 1
result:
wrong answer The answer is wrong: expected = 3, found = 2