QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#385799#4633. Coprime Matrices_LAP_WA 0ms3672kbC++14947b2024-04-11 06:47:102024-04-11 06:47:10

Judging History

你现在查看的是最新测评结果

  • [2024-04-11 06:47:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3672kb
  • [2024-04-11 06:47:10]
  • 提交

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 = get(x, y) - w;
    if(shift < 0) shift += n * m;

    int cur = 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 * m) + 1 << " \n"[j == m];

    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3672kb

input:

3 3 2 1 3

output:

Yes
9 3 4
1 2 5
6 7 8

result:

wrong answer A[x][y] not Equal w