QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#439898 | #6743. water235 | suibian_xiaozhao# | WA | 1ms | 3604kb | C++23 | 1.6kb | 2024-06-12 20:23:30 | 2024-06-12 20:23:31 |
Judging History
answer
//
// Created by DELLPC on 24-5-19.
//
#include "bits/stdc++.h"
using namespace std;
using i64 = long long;
using i32 = unsigned int;
#define endl '\n'
i64 mod = 998244353;
i64 qpow(i64 a, i64 b, i64 mods = 1e9 + 7) {
i64 ans = 1;
while (b) {
if (b & 1) {
ans = ans * a % mods;
}
a = a * a % mods;
b >>= 1;
}
return ans;
}
//求逆元
i64 inv(i64 a, i64 mods = 1e9 + 7) {
return qpow(a, mods - 2, mods);
}
void solve() {
int n, m;
cin >> n >> m;
// cerr << n << m << endl;
vector<vector<int>> arr(n + 1, vector<int>(n + 1));
int k = 0;
if (n % 2 == 0 && m % 2 == 0) {
for (int i = 1; i <= n; i += 2) {
arr[i][1] = 1;
k++;
}
for (int i = 2; i <= m; i += 2) {
arr[n][i] = 1;
k++;
}
} else {
for (int i = 1; i <= n; i += 2) {
arr[i][1] = 1;
k++;
}
if (n % 2 == 0) {
arr[n][1] = 1;
k++;
}
for (int i = 3; i <= m; i += 2) {
arr[1][i] = 1;
k++;
}
if (m % 2 == 0) {
arr[1][m] = 1;
k++;
}
}
cout << k << endl;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cout << arr[i][j] << " ";
}
cout << endl;
}
}
int main() {
// cerr << 1996488708ll * 2ll %mod<<endl;
ios::sync_with_stdio(0), cin.tie(0);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
}
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: 3532kb
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: 1ms
memory: 3596kb
input:
1 4
output:
3 1 0 1 1
result:
ok The answer is correct.
Test #4:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
2 2
output:
2 1 0 0 1
result:
ok The answer is correct.
Test #5:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
2 4
output:
3 1 0 0 0 0 1 0 1
result:
ok The answer is correct.
Test #6:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
4 3
output:
4 1 0 1 0 0 0 1 0 0 1 0 0
result:
ok The answer is correct.
Test #7:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
4 4
output:
4 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1
result:
ok The answer is correct.
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
1 789
output:
395 1 0 1 0 1 101473 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0...
result:
wrong answer Integer 101473 violates the range [0, 1]