QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#385798#4633. Coprime Matrices_LAP_WA 0ms3696kbC++14937b2024-04-11 06:44:342024-04-11 06:44:35

Judging History

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

  • [2024-04-11 06:44:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3696kb
  • [2024-04-11 06:44:34]
  • 提交

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]