QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#439895 | #6743. water235 | suibian_xiaozhao# | WA | 1ms | 3580kb | C++23 | 1.6kb | 2024-06-12 20:22:13 | 2024-06-12 20:22:15 |
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 = 1; 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();
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
2 1
output:
3 1 1
result:
wrong answer The answer is wrong: expected = 2, found = 3