QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#385798 | #4633. Coprime Matrices | _LAP_ | WA | 0ms | 3696kb | C++14 | 937b | 2024-04-11 06:44:34 | 2024-04-11 06:44:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 310;
int n, m, x, y, w, A[N][N];
inline int get(int x, int y) {
return (x - 1 >> 1 << 1) * m + (y - 1) * 2 + ((y & 1) ^ (x & 1)) + 1;
}
int main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n >> m >> x >> y >> w;
cout << "Yes" << '\n';
if(n == 1 && m == 1) {cout << "1" << '\n'; return 0; }
int shift = w - get(x, y);
if(shift < 0) shift += n * m;
int cur = 1 + shift;
for(int i = 1; i + 1 <= n; i += 2) {
for(int j = 1; j <= m; j ++) {
if(j & 1) A[i][j] = cur ++, A[i + 1][j] = cur ++;
else A[i + 1][j] = cur ++, A[i][j] = cur ++;
}
}
if(n & 1)
for(int j = 1; j <= m; j ++)
A[n][j] = cur ++;
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
cout << A[i][j] << " \n"[j == m];
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3696kb
input:
3 3 2 1 3
output:
Yes 2 5 6 3 4 7 8 9 10
result:
wrong answer Integer parameter [name=A[i][j]] equals to 10, violates the range [1, 9]